:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: #111827;
  --panel-2: #0f172a;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --line: #263244;
  --accent: #60a5fa;
  --accent-strong: #2563eb;
  --danger: #f87171;
  --danger-bg: #3b1218;
  --ok: #34d399;
  --ok-bg: #083c2c;
  --soft-blue: #1d4ed8;
  --soft-cyan: #155e75;
  --connection-windows: #60a5fa;
  --connection-linux: #f5b942;
  --connection-mikrotik: #c084fc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(circle at top left, #172554 0, transparent 34%), var(--bg);
  font:
    13px/1.35 Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
}

body.terminal-active {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

body.terminal-active .layout {
  height: calc(100vh - 48px);
  height: calc(100dvh - 48px);
  min-height: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

button,
.button {
  border: 0;
  border-radius: 4px;
  background: var(--accent-strong);
  color: #fff;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

button.small {
  padding: 5px 8px;
  font-size: 12px;
}

button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

button.danger-button {
  background: var(--danger-bg);
  color: var(--danger);
}

.icon-button {
  display: inline-flex;
  width: 26px;
  height: 26px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 3.5px;
  background: #0b1220;
  color: var(--accent);
  line-height: 1;
}

.icon-button:hover {
  border-color: var(--accent);
  background: #12213a;
}

.hidden {
  display: none !important;
}

.link-button {
  background: transparent;
  color: var(--accent);
  padding: 0;
}

.muted {
  color: var(--muted);
}

.error {
  padding: 10px;
  border-radius: 4px;
  background: var(--danger-bg);
  color: var(--danger);
  margin: 12px 0;
}

.notice {
  padding: 10px;
  border-radius: 4px;
  background: var(--ok-bg);
  color: var(--ok);
  margin: 12px 0;
}

.auth-card {
  width: min(380px, calc(100vw - 24px));
  margin: 8vh auto;
  background: rgb(17 24 39 / 94%);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 20px;
  box-shadow: 0 18px 60px rgb(0 0 0 / 35%);
}

.auth-card h1 {
  margin: 0;
}

.auth-card form {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

label {
  font-size: 12px;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 10px;
  font: inherit;
  color: var(--text);
  background: #0b1220;
}

select {
  cursor: pointer;
}

.auth-switch {
  margin-bottom: 0;
}

.topbar {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 14px;
  background: rgb(17 24 39 / 94%);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.brand {
  font-size: 17px;
  letter-spacing: 0.01em;
}

.future-menu {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  flex: 1;
}

.future-menu a,
.future-menu span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 2px 12px;
}

.future-menu a {
  color: var(--text);
}

.future-menu .future-menu-current {
  color: var(--accent);
  background: rgb(96 165 250 / 12%);
  border: 1px solid rgb(96 165 250 / 22%);
  border-radius: 4px;
  cursor: default;
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.layout {
  --favorites-width: 320px;
  position: relative;
  display: grid;
  grid-template-columns: var(--favorites-width) minmax(0, 1fr);
  gap: 0;
  padding: 0;
  min-height: calc(100vh - 48px);
}

.favorites,
.workspace {
  background: rgb(17 24 39 / 92%);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.favorites {
  --favorites-bg: #0f1928;
  --favorites-hover: #16263a;
  --favorites-active: #17383d;
  --favorites-line: #223249;
  --favorites-text: #dce7f5;
  --favorites-muted: #8799b3;
  --favorites-accent: #42dfbd;
  background: var(--favorites-bg);
  border: 0;
  border-right: 1px solid var(--favorites-line);
  border-radius: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.favorites-resizer {
  position: absolute;
  z-index: 30;
  top: 0;
  bottom: 0;
  left: calc(var(--favorites-width) - 3px);
  width: 7px;
  cursor: col-resize;
  touch-action: none;
}

.favorites-resizer::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 3px;
  width: 1px;
  background: transparent;
  transition: background-color 120ms ease;
}

.favorites-resizer:hover::after,
.favorites-resizer:focus-visible::after,
body.sidebar-resizing .favorites-resizer::after {
  background: var(--favorites-accent);
}

body.sidebar-resizing,
body.sidebar-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.workspace {
  min-width: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  overflow: hidden;
}

.workspace-overview {
  padding: 12px;
}

.workspace.connection-mode {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  background: #080d14;
}

.connection-tabs {
  display: flex;
  min-width: 0;
  min-height: 39px;
  flex: 0 0 39px;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid var(--line);
  background: #0b1421;
  scrollbar-color: #30445e #0b1421;
  scrollbar-width: thin;
}

.connection-tab {
  display: flex;
  min-width: 150px;
  max-width: 260px;
  flex: 0 1 220px;
  align-items: stretch;
  border-right: 1px solid var(--line);
  background: #0d1725;
  color: var(--muted);
}

.connection-tab.active {
  background: #152438;
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--favorites-accent, #42dfbd);
}

.connection-tab-main {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 7px;
  border-radius: 0;
  padding: 0 6px 0 11px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.connection-tab-main:hover,
.connection-tab-close:hover {
  background: rgb(66 223 189 / 8%);
}

.connection-tab-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-tab-state {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted);
}

.connection-tab.connected .connection-tab-state {
  background: var(--ok);
  box-shadow: 0 0 7px rgb(52 211 153 / 65%);
}

.connection-tab.has-error .connection-tab-state {
  background: var(--danger);
}

.connection-tab-close {
  display: inline-flex;
  width: 31px;
  flex: 0 0 31px;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 19px;
  line-height: 1;
}

.connection-tab-close:hover {
  color: var(--danger);
}

.connection-panels {
  min-width: 0;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.connection-tab-panel {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.favorites-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--favorites-line);
  background: #0b1421;
}

.favorites-tab {
  position: relative;
  display: inline-flex;
  min-width: 0;
  height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-right: 1px solid var(--favorites-line);
  border-radius: 0;
  padding: 0 10px;
  background: transparent;
  color: var(--favorites-muted);
}

.favorites-tab:last-child {
  border-right: 0;
}

.favorites-tab::after {
  content: '';
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 2px;
  background: transparent;
}

.favorites-tab:hover {
  background: var(--favorites-hover);
  color: var(--favorites-text);
}

.favorites-tab.active {
  background: #101d2d;
  color: var(--favorites-accent);
}

.favorites-tab.active::after {
  background: var(--favorites-accent);
}

.favorites-tab svg,
.ai-placeholder-icon svg,
.ai-composer button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.favorites-tab-panel {
  min-height: 0;
}

.favorites-connections-panel {
  flex: 1;
  padding: 8px 0 8px 8px;
  overflow: auto;
}

.favorites-ai-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding: 10px 10px 8px;
}

.favorites h2 {
  font-size: 13px;
  margin: 0;
  color: var(--favorites-text);
}

.favorites-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 8px 8px 0;
}

.favorites-title-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.favorites-title-actions .icon-button,
.favorites-title-actions svg {
  width: 26px;
  height: 26px;
}

.favorites-title-actions svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ai-empty {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
  color: var(--favorites-muted);
  text-align: center;
}

.ai-placeholder-icon {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  border: 1px solid rgb(66 223 189 / 35%);
  border-radius: 50%;
  background: rgb(66 223 189 / 8%);
  color: var(--favorites-accent);
}

.ai-placeholder-icon svg {
  width: 22px;
  height: 22px;
}

.ai-empty h2 {
  margin-bottom: 7px;
  font-size: 14px;
}

.ai-empty p {
  max-width: 220px;
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

.ai-panel-head {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--favorites-line);
}

#ai-new-chat,
#ai-clear-privilege {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  color: var(--favorites-accent);
}

#ai-new-chat svg,
#ai-clear-privilege svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

#ai-new-chat:disabled,
#ai-clear-privilege:disabled {
  color: #64748b;
  opacity: 0.75;
}

#ai-conversation-selector {
  min-width: 0;
  max-width: 112px;
  height: 27px;
  margin-left: auto;
  border: 1px solid #334155;
  border-radius: 4px;
  padding: 0 22px 0 6px;
  background: #101722;
  color: #aeb9c9;
  font-size: 10px;
  text-overflow: ellipsis;
}

#ai-conversation-selector:focus {
  border-color: #526176;
  outline: 0;
}

.ai-target {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: var(--favorites-text);
  font-size: 12px;
}

.ai-target span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-target-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--favorites-muted);
}

.ai-target.connected .ai-target-dot {
  background: var(--ok);
  box-shadow: 0 0 8px rgb(52 211 153 / 60%);
}

.ai-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  padding: 10px 4px 12px;
  overflow-y: auto;
  scrollbar-color: transparent transparent;
  scrollbar-width: thin;
}

.ai-messages:hover {
  scrollbar-color: rgb(126 143 166 / 50%) transparent;
}

.ai-messages::-webkit-scrollbar {
  width: 4px;
}

.ai-messages::-webkit-scrollbar-track {
  background: transparent;
}

.ai-messages::-webkit-scrollbar-thumb {
  border-radius: 4px;
  background: transparent;
}

.ai-messages:hover::-webkit-scrollbar-thumb {
  background: rgb(126 143 166 / 50%);
}

.ai-messages::-webkit-scrollbar-button {
  display: none;
}

.ai-message {
  max-width: 100%;
  padding: 5px 2px;
  color: var(--favorites-text);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.ai-message.user {
  align-self: flex-end;
  max-width: 90%;
  margin: 2px 0 8px;
  border-radius: 10px;
  padding: 8px 10px;
  background: #172131;
}

.ai-message.error {
  color: #fca5a5;
}

.ai-message.streaming {
  color: #d5dce6;
}

.ai-message.streaming::after {
  display: inline-block;
  width: 5px;
  height: 13px;
  margin-left: 3px;
  background: #9ca3af;
  content: '';
  vertical-align: -2px;
  animation: ai-stream-caret 0.9s steps(1) infinite;
}

.ai-task-progress {
  margin: 3px 0;
  color: var(--favorites-muted);
  font-size: 11px;
}

.ai-task-progress::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--favorites-accent);
  content: '';
  animation: ai-progress-pulse 1.1s ease-in-out infinite;
  vertical-align: 1px;
}

@keyframes ai-stream-caret {
  50% {
    opacity: 0;
  }
}

@keyframes ai-progress-pulse {
  50% {
    opacity: 0.35;
  }
}

.ai-message strong {
  color: #f1f5f9;
  font-weight: 600;
}

.ai-message code {
  border-radius: 3px;
  padding: 1px 4px;
  background: rgb(255 255 255 / 7%);
  color: #d5dce6;
  font:
    11px/1.45 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
}

.ai-command {
  margin: 1px 0 5px;
  color: var(--favorites-muted);
  font-size: 11px;
}

.ai-command summary {
  padding: 4px 2px;
  cursor: pointer;
  color: #aab4c2;
}

.ai-command code,
.ai-command pre {
  display: block;
  margin: 0;
  margin-left: 5px;
  padding: 5px 8px;
  border-left: 1px solid #334155;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ai-command pre {
  max-height: 220px;
  background: rgb(0 0 0 / 12%);
  color: #b9c7d8;
}

.ai-confirmation {
  border: 1px solid rgb(245 158 11 / 45%);
  border-radius: 4px;
  padding: 8px;
  background: rgb(120 53 15 / 16%);
  font-size: 11px;
}

.ai-confirmation code {
  display: block;
  margin: 6px 0;
  overflow-wrap: anywhere;
}

.ai-confirmation-actions {
  display: flex;
  gap: 6px;
}

.ai-privilege-credential {
  display: grid;
  gap: 7px;
  margin: 5px 0;
  border-left: 2px solid #c7a84b;
  padding: 7px 8px;
  background: rgb(199 168 75 / 7%);
  color: var(--favorites-text);
  font-size: 11px;
}

.ai-privilege-credential p {
  margin: 0;
  color: var(--favorites-muted);
  line-height: 1.4;
}

.ai-privilege-credential div {
  display: flex;
  gap: 6px;
}

.ai-privilege-credential input {
  min-width: 0;
  flex: 1;
  height: 27px;
  border: 1px solid #405068;
  border-radius: 4px;
  padding: 0 7px;
  background: #0f1621;
  color: var(--favorites-text);
  outline: 0;
}

.ai-privilege-credential input:focus {
  border-color: #c7a84b;
}

.ai-composer {
  display: flex;
  flex-direction: column;
  gap: 3px;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 5px 6px 5px 9px;
  background: #101722;
  box-shadow: 0 1px 8px rgb(0 0 0 / 16%);
}

.ai-composer:focus-within {
  border-color: #526176;
}

.ai-composer textarea {
  min-height: 48px;
  max-height: 150px;
  resize: none;
  border: 0;
  border-radius: 0;
  padding: 6px 2px;
  outline: 0;
  background: transparent;
  color: var(--favorites-text);
  box-shadow: none;
}

.ai-composer-footer {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-permission-picker {
  position: relative;
  min-width: 0;
  color: #c7a84b;
}

.ai-permission-trigger {
  display: inline-flex;
  width: auto;
  max-width: 190px;
  height: 28px;
  align-items: center;
  gap: 4px;
  border: 0;
  border-radius: 5px;
  padding: 0 5px;
  background: transparent;
  color: inherit;
  font-size: 11px;
  white-space: nowrap;
}

.ai-permission-trigger:hover:not(:disabled),
.ai-permission-trigger[aria-expanded='true'] {
  background: rgb(255 255 255 / 6%);
}

.ai-permission-picker[data-permission='diagnostic'] {
  color: #77b995;
}

.ai-permission-picker[data-permission='confirm_changes'] {
  color: #c7a84b;
}

.ai-permission-picker[data-permission='full_access'] {
  color: #e1b72d;
}

.ai-permission-picker svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ai-permission-picker .ai-permission-chevron {
  width: 12px;
  height: 12px;
}

.ai-permission-menu {
  position: absolute;
  z-index: 80;
  bottom: calc(100% + 6px);
  left: -4px;
  width: min(232px, calc(var(--favorites-width) - 28px));
  overflow: hidden;
  border: 1px solid #344156;
  border-radius: 6px;
  padding: 4px;
  background: #151b24;
  box-shadow: 0 10px 28px rgb(0 0 0 / 42%);
}

.ai-permission-menu .ai-permission-option {
  display: grid;
  width: 100%;
  height: auto;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  border: 0;
  border-radius: 4px;
  padding: 7px 8px;
  background: transparent;
  color: #d7dde7;
  text-align: left;
}

.ai-permission-option:hover,
.ai-permission-option:focus-visible,
.ai-permission-option.active {
  outline: 0;
  background: #253044;
}

.ai-permission-option-dot {
  width: 7px;
  height: 7px;
  margin-top: 4px;
  border-radius: 50%;
  background: #718096;
}

.ai-permission-option[data-permission-value='diagnostic'] .ai-permission-option-dot {
  background: #77b995;
}

.ai-permission-option[data-permission-value='confirm_changes'] .ai-permission-option-dot {
  background: #c7a84b;
}

.ai-permission-option[data-permission-value='full_access'] .ai-permission-option-dot {
  background: #e1b72d;
}

.ai-permission-option span:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.ai-permission-option strong {
  font-size: 11px;
  font-weight: 500;
}

.ai-permission-option small {
  color: #8793a5;
  font-size: 10px;
  line-height: 1.3;
}

.ai-model-label {
  margin-left: auto;
  color: var(--favorites-muted);
  font-size: 10px;
}

.ai-composer #ai-send {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #d6d9de;
  color: #20242b;
}

.ai-composer #ai-send:hover:not(:disabled) {
  background: #ffffff;
}

.ai-composer textarea:disabled,
.ai-composer select:disabled,
.ai-permission-trigger:disabled,
.ai-composer #ai-send:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.ai-composer #ai-send:disabled {
  background: #394252;
  color: #8994a3;
}

.ai-composer #ai-send .ai-send-spinner {
  stroke-dasharray: 34 14;
  transform-box: fill-box;
  transform-origin: center;
  animation: ai-send-spin 0.8s linear infinite;
}

@keyframes ai-send-spin {
  to {
    transform: rotate(360deg);
  }
}

.favorites .icon-button {
  border-color: var(--favorites-line);
  background: #0b1421;
  color: var(--favorites-accent);
}

.favorites .icon-button:hover {
  border-color: var(--favorites-accent);
  background: var(--favorites-hover);
}

.favorite-folder {
  display: grid;
  gap: 1px;
  margin-bottom: 2px;
  border-radius: 0;
}

.favorite-folder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  min-height: 24px;
  border: 0;
  border-radius: 0;
  padding: 1px 8px 1px 0;
  background: transparent;
  cursor: pointer;
  user-select: none;
  color: var(--favorites-text);
  transition: background 0.12s ease;
}

.favorite-folder-head:hover {
  background: var(--favorites-hover);
}

.favorite-folder-head > .folder-row {
  min-width: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-caret {
  display: inline-flex;
  flex: 0 0 auto;
  width: 16px;
  justify-content: center;
  margin-left: auto;
  color: var(--favorites-muted);
  font-size: 13px;
  line-height: 1;
}

.folder-icon {
  position: relative;
  display: inline-block;
  width: 17px;
  height: 13px;
  border-radius: 1px;
  background: var(--favorites-accent);
  color: transparent;
  font-size: 0;
  box-shadow: inset 0 -1px 0 rgb(0 0 0 / 20%);
}

.folder-icon::before {
  content: '';
  position: absolute;
  left: 1px;
  top: -4px;
  width: 8px;
  height: 5px;
  border-radius: 1px 1px 0 0;
  background: #73ead1;
}

.folder-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--favorites-text);
  text-overflow: ellipsis;
}

.favorite-folder-body {
  display: grid;
  gap: 1px;
  margin-left: 32px;
}

.favorite-folder.drag-over .favorite-folder-head,
.favorite-folder.drag-over .folder-empty {
  background: #19484a;
}

.folder-empty {
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 3px 8px 3px 0;
  color: var(--favorites-muted);
  text-align: left;
}

.favorites ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1px;
}

.favorites li {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 0;
  min-height: 26px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  transition:
    background 0.12s ease,
    opacity 0.15s ease,
    transform 0.15s ease;
}

.favorites li:hover {
  background: var(--favorites-hover);
}

.favorites li.active {
  background: var(--favorites-active);
}

.favorites li.active code {
  font-weight: 700;
}

.favorite-card.dragging {
  opacity: 0.45;
  transform: scale(0.98);
}

.favorite-open {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 2px 8px 2px 0;
  border-radius: 0;
  background: transparent;
  color: var(--favorites-text);
  text-align: left;
}

.connection-icon {
  display: inline-flex;
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  align-items: center;
  justify-content: center;
  border: 1px solid currentColor;
  border-radius: 3px;
  color: var(--favorites-accent);
}

.connection-icon svg,
.connection-type-icon svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.connection-icon.windows svg,
.connection-type-icon.windows svg {
  fill: currentColor;
  stroke: none;
}

.connection-icon.windows,
.connection-type-icon.windows {
  color: var(--connection-windows);
}

.connection-icon.linux,
.connection-type-icon.linux {
  color: var(--connection-linux);
}

.connection-icon.mikrotik,
.connection-type-icon.mikrotik {
  color: var(--connection-mikrotik);
}

.connection-icon.mikrotik svg,
.connection-type-icon.mikrotik svg {
  width: 14px;
  height: 14px;
  stroke-width: 1.7;
}

.favorite-card.active .connection-icon {
  box-shadow: 0 0 0 1px currentColor;
}

.connection-text {
  min-width: 0;
  display: grid;
  line-height: 1.1;
}

.linux-agent-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  margin-top: 3px;
  color: var(--favorites-muted);
  font-size: 10px;
  line-height: 1.2;
}

.linux-agent-badge i {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5b6a80;
}

.linux-agent-badge.online i {
  background: #42dfbd;
}

.linux-agent-badge.warning i {
  background: #f5bd4f;
}

.linux-agent-badge.offline i {
  background: #ee6b73;
}

.favorite-open code {
  display: block;
  color: var(--favorites-text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-open small {
  display: block;
  color: var(--favorites-muted);
  font-size: 10px;
  line-height: 1.1;
  margin-top: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-menu-trigger {
  display: inline-flex;
  width: 24px;
  height: 30px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: var(--favorites-muted);
  font-size: 12px;
  letter-spacing: -1px;
  opacity: 0.65;
}

.connection-menu-trigger:hover,
.connection-menu-trigger:focus-visible {
  background: rgb(66 223 189 / 10%);
  color: var(--favorites-accent);
  opacity: 1;
}

.terminal-workspace {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #080d14;
}

.terminal-screen {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 8px 4px 8px 8px;
  background: #080d14;
}

.terminal-screen .xterm {
  width: 100%;
  height: 100%;
}

.terminal-screen .xterm-viewport {
  scrollbar-color: #30445e #080d14;
  scrollbar-width: thin;
}

.windows-workspace {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #080d14;
}

.windows-screen {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border: 0;
  outline: 0;
  background: #080d14;
  cursor: none;
}

.windows-connection-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgb(8 13 20 / 82%);
  color: var(--muted);
  pointer-events: none;
}

.windows-connect-target {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 13px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

.context-menu {
  position: fixed;
  z-index: 1000;
  min-width: 190px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #0b1220;
  box-shadow: 0 18px 45px rgb(0 0 0 / 35%);
}

.context-menu button {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
  width: 100%;
  min-height: 32px;
  padding: 7px 9px;
  border-radius: 3.5px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.context-menu button .ui-icon {
  display: block;
  width: 16px;
  height: 16px;
  place-self: center;
  color: var(--muted);
}

.context-menu button span {
  display: block;
  min-width: 0;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-menu button:hover {
  background: #172554;
}

.context-menu button.danger {
  color: var(--danger);
}

.context-menu button.danger .ui-icon {
  color: var(--danger);
}

.context-menu button.danger:hover {
  background: var(--danger-bg);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgb(2 6 23 / 70%);
  backdrop-filter: blur(3px);
}

.modal-card {
  width: min(380px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 3.5px;
  background: rgb(17 24 39 / 98%);
  box-shadow: 0 22px 70px rgb(0 0 0 / 45%);
  padding: 14px;
}

.connection-modal-card {
  width: min(470px, calc(100vw - 36px));
}

.connection-type-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 4px;
}

.connection-type-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 7px 8px;
  background: #0b1421;
  color: var(--muted);
  font-size: 12px;
}

.connection-type-option:hover,
.connection-type-option.active {
  border-color: var(--accent-strong);
  background: rgb(29 78 216 / 18%);
  color: var(--text);
}

.connection-type-option:disabled:not(.active) {
  cursor: not-allowed;
  opacity: 0.45;
}

.connection-type-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid currentColor;
  border-radius: 3px;
  color: var(--accent);
}

.connection-form-panel {
  display: grid;
  gap: 8px;
}

.connection-form-panel.hidden {
  display: none;
}

.connection-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px;
  gap: 8px;
}

.connection-form-grid > div {
  display: grid;
  gap: 8px;
}

.form-error {
  margin: 2px 0 0;
  border: 1px solid rgb(248 113 113 / 35%);
  border-radius: 3px;
  padding: 7px 8px;
  background: rgb(127 29 29 / 18%);
  color: #fca5a5;
  font-size: 12px;
}

.ssh-test-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  margin-top: 2px;
}

.ssh-test-row.hidden {
  display: none;
}

.ssh-test-row button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
}

.ssh-test-row button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ssh-test-status {
  min-width: 0;
  font-size: 12px;
  line-height: 1.3;
}

.ssh-test-status.success {
  color: var(--ok);
}

.ssh-test-status.error {
  color: var(--danger);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-head h2 {
  margin: 0;
  font-size: 15px;
}

.modal-form {
  display: grid;
  gap: 8px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.modal-hint {
  margin: 0;
  font-size: 12px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-head h1 {
  margin: 0 0 4px;
}

.section-head p {
  margin: 0;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 26px;
  border-radius: 999px;
  background: #172554;
  color: var(--accent);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.device-card {
  display: grid;
  gap: 10px;
}

.device-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: linear-gradient(135deg, rgb(29 78 216 / 22%), rgb(21 94 117 / 12%));
}

.device-hero-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgb(96 165 250 / 35%);
  border-radius: 6px;
  color: var(--accent);
  background: rgb(15 23 42 / 72%);
}

.device-hero-main {
  min-width: 0;
}

.device-hero-title-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 5px;
}

.device-hero-title {
  font-size: 16px;
  line-height: 20px;
}

.device-hero-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
}

.ui-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.device-hero-icon .ui-icon {
  width: 22px;
  height: 22px;
}

.card-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgb(11 18 32 / 70%);
}

.card-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 7px 9px;
}

.card-tab.active {
  border-color: rgb(96 165 250 / 45%);
  color: var(--text);
  background: rgb(37 99 235 / 22%);
}

.card-tab-body {
  display: grid;
  gap: 10px;
}

.card-section {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-2);
  padding: 10px;
}

.card-section h2 {
  margin: 0 0 10px;
  font-size: 13px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.metric-card {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 10px;
  background: rgb(15 23 42 / 82%);
}

.metric-card .ui-icon {
  color: var(--accent);
  margin-top: 2px;
}

.metric-card span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.metric-card div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.info-row,
.tree-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px;
  background: rgb(11 18 32 / 62%);
}

.info-row > span,
.tree-row > span {
  color: var(--muted);
}

.info-row > div,
.tree-row > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.inventory-tree {
  max-height: calc(100vh - 250px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 4.5px;
  padding: 8px;
  background: #0b1220;
}

.empty-panel {
  border: 1px dashed var(--line);
  border-radius: 4.5px;
  padding: 14px;
  color: var(--muted);
  text-align: center;
  background: rgb(11 18 32 / 55%);
}

.card-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 4.5px;
}

.history-filters {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
}

.history-filters label {
  display: grid;
  gap: 5px;
  min-width: 220px;
}

.history-filters .link-button {
  min-height: 34px;
}

.card-table {
  min-width: 100%;
}

.card-table th,
.card-table td {
  white-space: normal;
  vertical-align: top;
}

.card-table td {
  overflow-wrap: anywhere;
}

.usage-cell {
  display: grid;
  gap: 4px;
  min-width: 130px;
}

.usage-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #0b1220;
  border: 1px solid var(--line);
}

.usage-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
}

.usage-caption {
  color: var(--muted);
  font-size: 11px;
}

.disk-type {
  display: grid;
  gap: 4px;
}

.disk-type > span:last-child {
  color: var(--muted);
  font-size: 11px;
}

.tree-list {
  display: grid;
  gap: 6px;
}

.tree-nested {
  margin-top: 6px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

details {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px;
  background: rgb(17 24 39 / 70%);
}

summary {
  color: var(--accent);
  cursor: pointer;
  font-weight: 400;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
}

th,
td {
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  font-weight: 400;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #0b1220;
}

tr:hover td {
  background: #162033;
}

tr:last-child td {
  border-bottom: 0;
}

code {
  font-family: 'SFMono-Regular', Consolas, monospace;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 11px;
}

h1,
h2,
h3,
h4,
h5,
h6,
strong,
b {
  font-weight: 400;
}

.status.online {
  color: var(--ok);
  background: var(--ok-bg);
}

.status.offline {
  color: #cbd5e1;
  background: #263244;
}

.status.failed {
  color: var(--danger);
  background: var(--danger-bg);
}

.empty-cell,
.empty {
  color: var(--muted);
  text-align: center;
}

.favorites .folder-empty {
  text-align: left;
}

.users-page {
  min-width: 0;
}

.users-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.users-actions form {
  margin: 0;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 0;
  }

  .favorites {
    border: 1px solid var(--line);
    border-radius: 6px;
  }

  .favorites-resizer {
    display: none;
  }

  .workspace {
    margin: 0;
  }

  .workspace.connection-mode {
    height: auto;
    min-height: 70vh;
  }

  body.terminal-active {
    height: auto;
    overflow: auto;
  }

  body.terminal-active .layout {
    height: auto;
  }

  .future-menu {
    display: none;
  }

  .metric-grid,
  .info-grid,
  .info-row,
  .tree-row {
    grid-template-columns: 1fr;
  }
}
