/* ==========================================================================
   Mulibox — дизайн у дусі macOS: світла й темна теми, скляні панелі, плавні анімації
   ========================================================================== */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Inter, Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "JetBrains Mono", monospace;
  --accent: #0a84ff; --accent-d: #0066d6; --accent-t: #fff;
  --green: #28c840; --red: #ff453a; --orange: #ff9f0a; --purple: #9b6cf2; --pink: #ff375f; --teal: #30b0c7;
  --radius: 12px; --ease: cubic-bezier(.2,.8,.2,1);

  --text: #1d1d1f; --text2: #6e6e73; --text3: #8e8e93;
  --bg: #f5f5f7;
  --wall: radial-gradient(1200px 700px at 8% 0%, #c9d8f5 0%, transparent 60%),
          radial-gradient(900px 600px at 95% 10%, #ead6f3 0%, transparent 55%),
          radial-gradient(1000px 700px at 60% 100%, #d4ecf0 0%, transparent 60%), #e9ecf2;
  --win: rgba(255,255,255,.86); --win-solid: #fff;
  --side: rgba(238,238,242,.72); --bar: rgba(250,250,252,.8);
  --card: #fff; --field: #fff; --field-line: #c7c7cc; --stripe: rgba(0,0,0,.025);
  --line: rgba(0,0,0,.08); --line2: rgba(0,0,0,.14);
  --hover: rgba(0,0,0,.05); --sel: rgba(0,0,0,.08);
  --accent-soft: #e8f2ff; --accent-soft-t: #0058b8;
  --green-soft: #e3f6e8; --green-t: #1a7f37; --red-soft: #ffeceb; --red-t: #c4221a;
  --orange-soft: #fff3e0; --orange-t: #8a4b00; --purple-soft: #f1ebff; --gray-soft: #f0f0f3;
  --shadow: 0 30px 80px rgba(20,30,60,.18), 0 2px 8px rgba(0,0,0,.06);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 1px rgba(0,0,0,.03);
  --menu: rgba(246,246,248,.92);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --text: #f5f5f7; --text2: #a1a1a6; --text3: #7c7c82;
  --bg: #111113;
  --wall: radial-gradient(1200px 700px at 8% 0%, #1d2b4a 0%, transparent 60%),
          radial-gradient(900px 600px at 95% 10%, #35213f 0%, transparent 55%),
          radial-gradient(1000px 700px at 60% 100%, #12343a 0%, transparent 60%), #0e0f12;
  --win: rgba(30,30,33,.86); --win-solid: #1e1e21;
  --side: rgba(44,44,48,.66); --bar: rgba(38,38,42,.82);
  --card: #232326; --field: #2a2a2e; --field-line: #48484d; --stripe: rgba(255,255,255,.025);
  --line: rgba(255,255,255,.08); --line2: rgba(255,255,255,.14);
  --hover: rgba(255,255,255,.06); --sel: rgba(255,255,255,.1);
  --accent-soft: rgba(10,132,255,.18); --accent-soft-t: #6cb4ff;
  --green-soft: rgba(48,209,88,.16); --green-t: #4cd964; --red-soft: rgba(255,69,58,.16); --red-t: #ff6961;
  --orange-soft: rgba(255,159,10,.16); --orange-t: #ffb340; --purple-soft: rgba(155,108,242,.18); --gray-soft: rgba(255,255,255,.07);
  --shadow: 0 30px 80px rgba(0,0,0,.55), 0 2px 8px rgba(0,0,0,.3);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --menu: rgba(44,44,48,.94);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--text); background: var(--bg); font-size: 14px; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.2px; }
p { margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--text2); }
.mono { font-family: var(--mono); }
.small { font-size: 12px; }
::selection { background: rgba(10,132,255,.3); }
:focus-visible { outline: 3px solid rgba(10,132,255,.5); outline-offset: 1px; border-radius: 6px; }

/* ---------- Анімації ---------- */
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(40,200,64,.5); } 50% { box-shadow: 0 0 0 5px rgba(40,200,64,0); } }
.window { animation: pop .45s var(--ease) both; }
.grid > * { animation: fadeUp .45s var(--ease) both; }
.grid > *:nth-child(2) { animation-delay: .04s; } .grid > *:nth-child(3) { animation-delay: .08s; } .grid > *:nth-child(4) { animation-delay: .12s; }
.grid > *:nth-child(5) { animation-delay: .16s; } .grid > *:nth-child(n+6) { animation-delay: .2s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }

/* ---------- Кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line2); background: var(--card); color: var(--text); font: 500 13px var(--font); cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .15s, transform .1s, box-shadow .15s; box-shadow: var(--shadow-sm); }
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.primary { background: linear-gradient(180deg, #2b95ff, var(--accent)); border-color: transparent; color: #fff; box-shadow: 0 1px 2px rgba(10,132,255,.4), inset 0 1px 0 rgba(255,255,255,.2); }
.btn.primary:hover { background: linear-gradient(180deg, #3d9fff, #1a8bff); }
.btn.danger { color: var(--red-t); }
.btn.danger.primary { background: var(--red); color: #fff; }
.btn.big { height: 46px; padding: 0 26px; font-size: 16px; border-radius: 980px; }
.btn.block { width: 100%; height: 38px; font-size: 14px; }
.btn.icon { width: 32px; padding: 0; border-color: transparent; background: transparent; box-shadow: none; color: var(--text2); }
.btn.icon:hover { background: var(--hover); color: var(--text); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--hover); }
.btn svg { flex: none; }

/* ---------- Поля ---------- */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text2); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url], select, textarea {
  height: 34px; padding: 0 10px; font: 13px var(--font); border-radius: 8px; border: 1px solid var(--field-line); background: var(--field); color: var(--text); width: 100%; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 8px 10px; font-family: var(--mono); resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(10,132,255,.25); }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text); line-height: 1.4; cursor: pointer; }
.check input { margin: 2px 0 0; accent-color: var(--accent); }
.switch { position: relative; width: 38px; height: 22px; flex: none; appearance: none; -webkit-appearance: none; background: var(--line2); border-radius: 11px; cursor: pointer; transition: background .2s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s var(--ease); }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(16px); }
.seg { display: inline-flex; padding: 2px; background: var(--hover); border-radius: 9px; gap: 2px; }
.seg button { flex: 1; height: 28px; padding: 0 12px; border: none; border-radius: 7px; background: transparent; font: 500 13px var(--font); color: var(--text); cursor: pointer; white-space: nowrap; transition: background .15s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button[aria-pressed=true] { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.seg.full { display: flex; }

/* ---------- Робочий стіл і вікно ---------- */
.desk { min-height: 100vh; background: var(--wall); background-attachment: fixed; display: flex; justify-content: center; align-items: flex-start; padding: 22px 16px; }
.desk.center { align-items: center; }
.window { width: 100%; background: var(--win); border-radius: 14px; border: 1px solid var(--line2); box-shadow: var(--shadow); overflow: hidden; backdrop-filter: blur(30px) saturate(160%); -webkit-backdrop-filter: blur(30px) saturate(160%); }
.lights { display: flex; gap: 8px; align-items: center; height: 16px; }
.lights span { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 .5px rgba(0,0,0,.15); }
.lights span:nth-child(1) { background: #ff5f57; } .lights span:nth-child(2) { background: #febc2e; } .lights span:nth-child(3) { background: #28c840; }
.brandmark { display: flex; align-items: center; gap: 9px; padding: 2px 8px; color: var(--text); text-decoration: none; font-size: 15px; letter-spacing: -.2px; }
.brandmark:hover { text-decoration: none; }
.brandmark img { width: 26px; height: 26px; border-radius: 7px; box-shadow: 0 3px 10px rgba(59,130,246,.35); transition: transform .2s var(--ease); }
.brandmark:hover img { transform: rotate(-6deg) scale(1.05); }
.side .back-link { color: var(--text2); margin-top: -10px; }
.conn-card { position: relative; display: grid; grid-template-columns: 40px 1fr; gap: 4px 10px; align-items: center; padding: 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm); overflow: hidden; }
.conn-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, #5eead4, #3b82f6 50%, #a855f7); }
.conn-av { --h: 220; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .3px;
  background: linear-gradient(135deg, hsl(var(--h) 80% 62%), hsl(calc(var(--h) + 50) 75% 48%)); box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 4px 12px hsl(var(--h) 70% 45% / .35); }
.conn-meta { display: flex; flex-direction: column; min-width: 0; }
.conn-meta strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn-meta span { font-size: 11.5px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn-card .pill { grid-column: 1 / -1; justify-self: start; margin-top: 6px; }

/* Застосунок для Mac/Windows: вікно на весь екран, без «вікна у вікні» */
.in-desktop .desk:not(.center) { padding: 0; min-height: 100vh; }
.in-desktop .window.app { max-width: none !important; border-radius: 0; border: 0; box-shadow: none; min-height: 100vh; }
.in-desktop .app { min-height: 100vh; }
/* Вхід/реєстрація в застосунку: акуратна картка по центру на фірмовому фоні, вікно можна тягнути за фон */
.in-desktop .desk.center { min-height: 100vh; padding: 48px 16px 24px; -webkit-app-region: drag; }
.in-desktop .desk.center .window { -webkit-app-region: no-drag; }
.in-desktop .toolbar { -webkit-app-region: drag; }
.in-desktop .toolbar :is(button, a, input, select, .seg, .crumbs) { -webkit-app-region: no-drag; }
.in-desktop.os-darwin .side::before { content: ""; display: block; height: 26px; margin: -14px -10px -10px; -webkit-app-region: drag; }

.titlebar { height: 40px; display: flex; align-items: center; padding: 0 14px; border-bottom: 1px solid var(--line); }

.app { max-width: 1320px; min-height: calc(100vh - 44px); display: flex; flex-wrap: wrap; }
.side { flex: 1 1 220px; max-width: 100%; background: var(--side); border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 18px; backdrop-filter: blur(40px) saturate(180%); -webkit-backdrop-filter: blur(40px) saturate(180%); }
.side h4 { margin: 0; font-size: 11px; font-weight: 600; color: var(--text3); padding: 0 8px 4px; }
.side nav, .side .group { display: flex; flex-direction: column; gap: 1px; }
.side a, .side button.item { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 7px; color: var(--text); font: 13px var(--font); text-decoration: none; border: none; background: none; cursor: pointer; text-align: left; transition: background .12s; }
.side a:hover, .side button.item:hover { background: var(--hover); text-decoration: none; }
.side a.on { background: var(--sel); font-weight: 500; }
.side a .count { margin-left: auto; font-size: 11px; color: var(--text3); }
.side .ico-tint { color: var(--accent); display: flex; }
.side .foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 4px; }
.me-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; background: var(--hover); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #5ac8fa, #0a84ff); color: #fff; font-weight: 600; font-size: 13px; display: flex; align-items: center; justify-content: center; flex: none; }
.me-card .who { min-width: 0; display: flex; flex-direction: column; font-size: 12px; }
.me-card .who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; background: var(--win-solid); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bar); min-height: 52px; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); position: sticky; top: 0; z-index: 4; }
.toolbar h1 { font-size: 15px; font-weight: 600; flex: 1 1 auto; }
.content { padding: 24px 22px 40px; }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -.5px; margin-bottom: 4px; }

/* ---------- Картки ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card { border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--card); box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), box-shadow .2s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0,0,0,.1); }
.card .head { display: flex; align-items: center; gap: 12px; }
.card .ico { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex: none; }
.card h2 { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .addr { font: 12px var(--mono); color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .row { display: flex; gap: 8px; }
.card .row .btn.primary { flex: 1; }
.bars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bar { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--text2); }
.bar .track { height: 5px; border-radius: 3px; background: var(--hover); overflow: hidden; }
.bar .track div { height: 100%; border-radius: 3px; background: var(--green); transition: width .6s var(--ease); }
.bar .track div.warn { background: var(--orange); } .bar .track div.bad { background: var(--red); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text3); display: inline-block; flex: none; }
.dot.on { background: var(--green); animation: pulse 2.4s infinite; } .dot.off { background: var(--red); }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 10px; background: var(--gray-soft); color: var(--text2); white-space: nowrap; }
.pill.green { background: var(--green-soft); color: var(--green-t); }
.pill.blue { background: var(--accent-soft); color: var(--accent-soft-t); }
.pill.orange { background: var(--orange-soft); color: var(--orange-t); }
.pill.purple { background: var(--purple-soft); color: var(--purple); }
.pill.red { background: var(--red-soft); color: var(--red-t); }
.add-card { border: 1.5px dashed var(--line2); border-radius: 14px; min-height: 160px; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text2); font: 13px var(--font); cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.add-card:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text2); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty-state .big-ico { width: 72px; height: 72px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.empty-state h2 { color: var(--text); font-size: 18px; }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; background: var(--orange-soft); color: var(--orange-t); font-size: 13px; margin-bottom: 18px; flex-wrap: wrap; animation: fadeUp .4s var(--ease); }
.banner.blue { background: var(--accent-soft); color: var(--accent-soft-t); }
.banner.green { background: var(--green-soft); color: var(--green-t); }
.banner .btn { margin-left: auto; }

/* ---------- Діалоги й меню ---------- */
dialog { border: 1px solid var(--line2); border-radius: 16px; padding: 0; width: min(500px, calc(100vw - 32px)); box-shadow: 0 30px 90px rgba(0,0,0,.35); color: var(--text); background: var(--win-solid); }
dialog[open] { animation: pop .28s var(--ease); }
dialog::backdrop { background: rgba(0,0,0,.28); backdrop-filter: blur(3px); animation: fade .2s; }
dialog form, dialog .body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
dialog h2 { font-size: 17px; font-weight: 600; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
dialog.wide { width: min(920px, calc(100vw - 32px)); }
.two { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }
.cols2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.note { font-size: 12px; color: var(--text2); line-height: 1.45; }
.warn { font-size: 12px; line-height: 1.45; padding: 10px 12px; border-radius: 10px; background: var(--orange-soft); color: var(--orange-t); }
.danger-note { background: var(--red-soft); color: var(--red-t); }
.error { color: var(--red-t); font-size: 13px; }
.error:empty { display: none; }
.ctx { position: fixed; z-index: 60; min-width: 200px; background: var(--menu); border: 1px solid var(--line2); border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.25); padding: 5px; display: flex; flex-direction: column; backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); animation: pop .14s var(--ease); }
.ctx button { text-align: left; border: none; background: none; padding: 6px 10px; border-radius: 6px; font: 13px var(--font); color: var(--text); cursor: pointer; display: flex; align-items: center; gap: 8px; }
.ctx button:hover { background: var(--accent); color: #fff; }
.ctx button.danger { color: var(--red-t); } .ctx button.danger:hover { background: var(--red); color: #fff; }
.ctx hr { border: none; border-top: 1px solid var(--line); margin: 4px 0; }

/* ---------- Сповіщення ---------- */
#toasts { position: fixed; top: 16px; right: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(340px, calc(100vw - 32px)); }
.toast { padding: 12px 14px; border-radius: 14px; background: var(--menu); border: 1px solid var(--line); box-shadow: 0 12px 34px rgba(0,0,0,.2); font-size: 13px; display: flex; flex-direction: column; gap: 6px; animation: slideIn .3s var(--ease); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); }
.toast.err { border-color: rgba(255,69,58,.4); }
.progress { height: 4px; border-radius: 2px; background: var(--hover); overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ---------- Файловий менеджер ---------- */
.crumbs { display: flex; align-items: center; gap: 2px; font-size: 13px; flex: 1 1 200px; min-width: 0; flex-wrap: wrap; }
.crumbs button { border: none; background: none; padding: 3px 6px; border-radius: 6px; color: var(--text2); font: 13px var(--font); cursor: pointer; }
.crumbs button:hover { background: var(--hover); color: var(--text); }
.crumbs button:last-child { color: var(--text); font-weight: 600; }
.crumbs .sep { color: var(--text3); }
.files { flex: 1 1 auto; overflow: auto; position: relative; min-height: 220px; }
.files table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 13px; }
.files th { text-align: left; font-size: 11px; font-weight: 500; color: var(--text2); padding: 8px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--win-solid); z-index: 1; }
.files td { padding: 5px 12px; white-space: nowrap; }
.files tr.item:nth-child(even) { background: var(--stripe); }
.files tr.item { cursor: default; user-select: none; transition: background .08s; }
.files tr.item:hover { background: var(--hover); }
.files tr.item.sel, .files tr.item.sel:hover { background: var(--accent) !important; color: #fff; }
.files tr.item.sel td { color: #fff !important; }
.files td.name { max-width: 520px; }
.files td.name .nm { display: flex; align-items: center; gap: 9px; overflow: hidden; }
.files td.name .nm > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.files td.sub { color: var(--text2); }
.files td.num { text-align: right; font-variant-numeric: tabular-nums; }
.icons-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; padding: 14px; }
.icons-view .tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border-radius: 10px; cursor: default; user-select: none; text-align: center; font-size: 12px; transition: background .1s; }
.icons-view .tile:hover { background: var(--hover); }
.icons-view .tile span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-all; padding: 1px 4px; border-radius: 4px; }
.icons-view .tile.sel { background: var(--sel); } .icons-view .tile.sel span { background: var(--accent); color: #fff; }
.statusbar { display: flex; align-items: center; gap: 12px; padding: 6px 16px; font-size: 11px; color: var(--text2); border-top: 1px solid var(--line); background: var(--bar); }
.drop { position: absolute; inset: 10px; border: 2px dashed var(--accent); border-radius: 14px; background: rgba(10,132,255,.1); display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; font-size: 16px; font-weight: 600; color: var(--accent); pointer-events: none; z-index: 3; animation: fade .15s; backdrop-filter: blur(2px); }
.quicklook { display: flex; align-items: center; justify-content: center; background: #000; border-radius: 10px; min-height: 300px; max-height: 70vh; overflow: hidden; }
.quicklook img { max-width: 100%; max-height: 70vh; object-fit: contain; }

/* ---------- Термінал ---------- */
.split { height: 7px; cursor: row-resize; background: var(--bar); border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.split::after { content: ""; width: 36px; height: 3px; border-radius: 2px; background: var(--line2); }
.term { background: #1c1c1e; display: flex; flex-direction: column; height: 300px; min-height: 100px; }
.term.max { height: 72vh; }
.term-tabs { display: flex; align-items: center; gap: 4px; padding: 6px 10px 0; background: #2a2a2d; }
.term-tabs .tab { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 7px 7px 0 0; color: #a1a1a6; font-size: 12px; border: none; background: none; cursor: pointer; font-family: var(--font); }
.term-tabs .tab.on { background: #1c1c1e; color: #f2f2f7; }
.term-tabs .tab .x { opacity: .6; padding: 0 2px; }
.term-tabs .tbtn { height: 26px; min-width: 26px; padding: 0 6px; border: none; border-radius: 6px; background: transparent; color: #a1a1a6; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 5px; font: 12px var(--font); }
.term-tabs .tbtn:hover { background: rgba(255,255,255,.08); color: #fff; }
.term-body { flex: 1; min-height: 0; position: relative; }
.term-body > div { position: absolute; inset: 6px 4px 4px 10px; }

/* ---------- Робоча область сервера ---------- */
.ws-body { flex: 1; display: flex; min-height: 0; }
.ws-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.view { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: auto; }
.ai-panel { width: 360px; max-width: 100%; border-left: 1px solid var(--line); display: flex; flex-direction: column; background: var(--side); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); animation: slideIn .3s var(--ease); }
.ai-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 600; }
.ai-msgs { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.msg { padding: 10px 12px; border-radius: 14px; font-size: 13px; line-height: 1.5; max-width: 100%; animation: fadeUp .25s var(--ease); overflow-wrap: anywhere; }
.msg.me { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; max-width: 85%; }
.msg.bot { background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg pre { background: #1c1c1e; color: #e5e5ea; padding: 10px; border-radius: 8px; margin: 8px 0 4px; font: 12px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg pre.danger { box-shadow: 0 0 0 2px var(--red); }
.msg code { font-family: var(--mono); font-size: 12px; background: var(--hover); padding: 1px 4px; border-radius: 4px; }
.msg .cmd-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ai-input { padding: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.ai-input textarea { font-family: var(--font); min-height: 60px; }
.actions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.action { text-align: left; border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--card); cursor: pointer; display: flex; flex-direction: column; gap: 6px; font: 13px var(--font); color: var(--text); transition: transform .15s var(--ease), box-shadow .15s, border-color .15s; }
.action:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.08); border-color: var(--accent); }
.action b { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.action span { color: var(--text2); font-size: 12px; }
.out { background: #1c1c1e; color: #e5e5ea; font: 12px/1.55 var(--mono); padding: 12px; border-radius: 10px; min-height: 160px; max-height: 50vh; overflow: auto; white-space: pre-wrap; margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile-stat { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: var(--card); display: flex; flex-direction: column; gap: 4px; }
.tile-stat .lbl { font-size: 12px; color: var(--text2); }
.tile-stat .val { font-size: 26px; font-weight: 700; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.tile-stat .sub { font-size: 12px; color: var(--text2); }
.chart { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: var(--card); }
.chart h3 { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.chart svg { width: 100%; height: 110px; display: block; }

/* ---------- Сторінки входу ---------- */
.auth { width: 100%; max-width: 420px; }
.auth form, .auth .body { display: flex; flex-direction: column; align-items: stretch; gap: 16px; padding: 30px 36px 30px; }
.auth .logo { width: 64px; height: 64px; border-radius: 15px; display: block; margin: 0 auto; box-shadow: 0 10px 24px rgba(40,60,160,.3); overflow: hidden; }
.auth h1 { text-align: center; font-size: 22px; font-weight: 600; }
.auth .sub { text-align: center; font-size: 13px; color: var(--text2); margin-top: -8px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--text3); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.code-input { text-align: center; font: 600 22px var(--mono) !important; letter-spacing: 6px; height: 48px !important; }
.btn.apple { background: #000; color: #fff; border-color: #000; }
:root[data-theme="dark"] .btn.apple { background: #fff; color: #000; }

/* ---------- Налаштування і таблиці ---------- */
.section { border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; background: var(--card); animation: fadeUp .4s var(--ease) both; }
.section h2 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.list > div { display: flex; align-items: center; gap: 12px; padding: 10px 12px; font-size: 13px; flex-wrap: wrap; }
.list > div + div { border-top: 1px solid var(--line); }
.list .grow { flex: 1; min-width: 160px; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; font: 14px var(--mono); padding: 12px; background: var(--hover); border-radius: 8px; }
pre.key { white-space: pre-wrap; word-break: break-all; font: 12px var(--mono); background: var(--hover); padding: 10px; border-radius: 8px; margin: 0; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; font-size: 11px; font-weight: 500; color: var(--text2); padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.tbl tr:last-child td { border-bottom: none; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.row-flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Тарифи ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.plan { border: 1px solid var(--line); border-radius: 20px; padding: 26px; background: var(--card); display: flex; flex-direction: column; gap: 14px; position: relative; transition: transform .2s var(--ease), box-shadow .2s; }
.plan:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(0,0,0,.1); }
.plan.best { border: 2px solid var(--accent); }
.plan .tag { position: absolute; top: -11px; left: 24px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 10px; }
.plan h3 { font-size: 19px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.plan .price { font-size: 36px; font-weight: 700; letter-spacing: -1px; }
.plan .price small { font-size: 15px; font-weight: 500; color: var(--text2); letter-spacing: 0; }
.plan ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.4; flex: 1; }
.plan li { display: flex; gap: 8px; align-items: flex-start; }
.plan li::before { content: "✓"; color: var(--green); font-weight: 700; }

@media (max-width: 760px) {
  .desk { padding: 0; }
  .window { border-radius: 0; border: none; }
  .app { min-height: 100vh; }
  .side { flex-direction: row; flex-wrap: wrap; gap: 8px; padding: 10px; }
  .side .lights, .side h4, .side .foot .me-card { display: none; }
  .side nav, .side .group { flex-direction: row; flex-wrap: wrap; }
  .side .foot { margin-top: 0; flex-direction: row; }
  .term { height: 42vh; }
  .ai-panel { position: fixed; inset: 0; width: 100%; z-index: 50; background: var(--win-solid); }
  .content { padding: 18px 14px 32px; }
}

/* ---------- Телефони й планшети: без випадкового збільшення ---------- */
/* iOS збільшує сторінку, коли поле вводу має шрифт менший за 16px, і при подвійному дотику */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }
a, button, [role=button], [role=tab], .row, .tile, .card, label, summary { touch-action: manipulation; }
@media (pointer: coarse), (max-width: 760px) {
  input, select, textarea, [contenteditable], .xterm-helper-textarea { font-size: 16px !important; }
}
