:root {
  --bg: #101318;
  --panel: #171b22;
  --panel-2: #1e232c;
  --panel-3: #262c37;
  --border: #2b323d;
  --text: #e7eaf0;
  --muted: #98a2b3;
  --accent: #5b9dff;
  --accent-dim: #24405f;
  --danger: #ff6b6b;
  --ok: #4ade80;
  --warn: #fbbf24;
  --radius: 8px;
  --shadow: 0 10px 30px rgb(0 0 0 / 45%);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.spacer {
  flex: 1 1 auto;
}

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

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 11px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.06s ease;
}

button:hover:not(:disabled) {
  background: var(--panel-3);
  border-color: #3b4454;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #08121f;
  font-weight: 600;
}

button.primary:hover:not(:disabled) {
  background: #74aeff;
  border-color: #74aeff;
}

button.danger {
  color: var(--danger);
  border-color: #4a2b30;
}

button.danger:hover:not(:disabled) {
  background: #2a1a1d;
}

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

button.ghost:hover:not(:disabled) {
  background: var(--panel-2);
  color: var(--text);
}

button.icon-btn {
  width: 32px;
  padding: 6px 0;
  text-align: center;
}

input[type="text"],
input[type="password"],
input[type="search"],
input:not([type]) {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  outline: none;
}

input:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 2px rgb(91 157 255 / 18%);
}

/* ------------------------------------------------------------------ login */

.login-view {
  display: grid;
  place-items: center;
  height: 100%;
  background:
    radial-gradient(1200px 600px at 20% -10%, #16233a 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 100%, #1b2a1f 0%, transparent 55%);
}

.login-card {
  width: min(360px, 92vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
}

.login-card .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-size: 18px;
  font-weight: 600;
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.login-error {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

/* --------------------------------------------------------------- file manager */

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

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.chip {
  font-size: 12px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  max-width: 46vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-input {
  width: min(280px, 40vw);
}

.switch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  user-select: none;
  cursor: pointer;
}

.user-badge {
  font-size: 12px;
  color: var(--muted);
  border-left: 1px solid var(--border);
  padding-left: 10px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  white-space: nowrap;
  font-size: 13px;
}

.breadcrumbs button {
  background: transparent;
  border: none;
  padding: 2px 6px;
  color: var(--accent);
  border-radius: 5px;
}

.breadcrumbs button:hover {
  background: var(--panel-2);
}

.breadcrumbs .sep {
  color: #4a5364;
}

.breadcrumbs .current {
  color: var(--text);
  padding: 2px 6px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  font-size: 13px;
}

.toolbar .divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.content {
  flex: 1 1 auto;
  overflow: auto;
  position: relative;
}

.search-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: #1b2536;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: #cfe0ff;
  position: sticky;
  top: 0;
  z-index: 2;
}

/* ------------------------------------------------------------------- table */

.listing {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.listing thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-2);
  color: var(--muted);
  text-align: left;
  font-weight: 500;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.listing th.sortable {
  cursor: pointer;
  user-select: none;
}

.listing th.sortable:hover {
  color: var(--text);
}

.listing th[data-active="true"] {
  color: var(--accent);
}

.listing td {
  padding: 6px 10px;
  border-bottom: 1px solid #212632;
  vertical-align: middle;
}

.listing tbody tr:hover {
  background: #191e27;
}

.listing tbody tr.selected {
  background: #1b2635;
}

.col-check {
  width: 34px;
}

.col-size,
.col-mtime,
.col-mode {
  width: 118px;
  white-space: nowrap;
}

.col-actions {
  width: 150px;
  text-align: right;
  white-space: nowrap;
}

.name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.name-cell .label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.name-cell .label:hover {
  text-decoration: underline;
}

.name-cell .label.dir {
  color: #9fc6ff;
  font-weight: 500;
}

.icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--panel-3);
  color: var(--muted);
}

.icon .icon-svg {
  width: 15px;
  height: 15px;
}

.icon.folder {
  background: #223049;
  color: #8ab6ff;
}

.icon.image {
  background: #26362a;
  color: #86e0a4;
}

.icon.code {
  background: #2c2743;
  color: #b9a6ff;
}

.icon.archive {
  background: #3a2f22;
  color: #ffc98a;
}

.icon.text {
  background: #22303a;
  color: #93cfe6;
}

.icon.exec {
  background: #1f3330;
  color: #6ee7c8;
}

.row-actions button {
  padding: 4px 8px;
  font-size: 12px;
  margin-left: 4px;
}

.pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--muted);
}

.pill.warn {
  background: #3a2f14;
  color: var(--warn);
}

.badge-exec {
  font-size: 11px;
  color: var(--ok);
  margin-left: 6px;
}

.link-target {
  color: var(--muted);
  font-size: 12px;
}

.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

/* --------------------------------------------------------------- statusbar */

.statusbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  font-size: 12px;
}

#status-upload {
  display: flex;
  align-items: center;
  gap: 8px;
}

progress {
  width: 160px;
  height: 8px;
  border: none;
  border-radius: 4px;
  background: var(--panel-3);
}

progress::-webkit-progress-bar {
  background: var(--panel-3);
  border-radius: 4px;
}

progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 4px;
}

progress::-moz-progress-bar {
  background: var(--accent);
  border-radius: 4px;
}

/* ---------------------------------------------------------------- overlays */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgb(8 10 14 / 72%);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.editor-shell {
  width: min(1400px, 100%);
  height: min(900px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.editor-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  flex-wrap: wrap;
}

.editor-header strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60vw;
}

kbd {
  background: rgb(0 0 0 / 25%);
  border-radius: 4px;
  padding: 0 4px;
  font-size: 11px;
}

.monaco {
  flex: 1 1 auto;
  min-height: 0;
}

.editor-footer {
  padding: 6px 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.preview-shell {
  width: min(1100px, 100%);
  height: min(800px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.preview-body {
  flex: 1 1 auto;
  overflow: auto;
  display: grid;
  place-items: center;
  background: #0d1014;
  padding: 16px;
}

.preview-body img {
  max-width: 100%;
  max-height: 100%;
}

a.ghost {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius);
}

a.ghost:hover {
  background: var(--panel-2);
  color: var(--text);
}

.modal-card {
  width: min(440px, 94vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
}

.modal-card h2 {
  margin: 0;
  font-size: 16px;
}

.modal-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

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

/* ------------------------------------------------------------------ drop UI */

.drop-hint {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgb(10 16 26 / 82%);
  border: 3px dashed var(--accent);
  font-size: 18px;
  color: #d9e8ff;
  pointer-events: none;
}

/* ------------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, 90vw);
}

.toast {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: toast-in 0.16s ease-out;
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.ok {
  border-left-color: var(--ok);
}

.toast.warn {
  border-left-color: var(--warn);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 720px) {
  .col-mode,
  .col-mtime {
    display: none;
  }

  .topbar {
    gap: 8px;
  }

  .chip {
    max-width: 100%;
  }
}

/* ------------------------------------------------------------------- icons */

/* Visos ikonos – linijinės (stroke), spalvą ima iš teksto spalvos. */
svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.brand-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.login-card .brand-icon {
  width: 26px;
  height: 26px;
}

.btn-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.editor-header .btn-icon,
.icon-btn .btn-icon {
  width: 16px;
  height: 16px;
}

.switch .btn-icon {
  width: 14px;
  height: 14px;
}

.row-actions .icon-svg {
  width: 15px;
  height: 15px;
}

.row-actions button {
  padding: 4px 7px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.empty-icon {
  width: 34px;
  height: 34px;
  opacity: 0.45;
  margin-bottom: 8px;
}

.drop-hint {
  gap: 10px;
  flex-direction: column;
}

.drop-icon {
  width: 42px;
  height: 42px;
  color: var(--accent);
}

.input-wrap {
  position: relative;
  display: block;
}

.input-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}

.input-wrap input {
  padding-left: 30px;
  width: 100%;
}

.icon.plain {
  background: var(--panel-3);
  color: var(--muted);
}

.icon.link {
  background: #2b2f3d;
  color: #c6cede;
}

a.ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Redaktoriaus kalbos pasirinkimas (syntax highlighting) */
select.language-select {
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  color: var(--text);
  max-width: 190px;
  cursor: pointer;
}

/* ---------------------------------------------------------- upload progress */

.upload-panel {
  position: fixed;
  right: 16px;
  bottom: 58px;
  z-index: 70;
  width: min(430px, 92vw);
  max-height: 46vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.upload-panel header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.upload-overall {
  padding: 8px 10px;
}

.upload-overall progress {
  width: 100%;
}

.upload-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
}

.upload-row {
  padding: 7px 10px;
  border-bottom: 1px solid #212632;
  font-size: 12px;
}

.upload-row:last-child {
  border-bottom: none;
}

.upload-row-failed .upload-name {
  color: var(--danger);
}

.upload-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-track {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.upload-track progress {
  flex: 0 0 90px;
  height: 6px;
}

.upload-detail {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-state {
  margin-left: auto;
  white-space: nowrap;
}

.upload-state.ok {
  color: var(--ok);
}

.upload-state.error {
  color: var(--danger);
}

/* --------------------------------------------------------------- terminalas */

.terminal-shell {
  width: min(1400px, 100%);
  height: min(900px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.terminal-host {
  flex: 1 1 auto;
  min-height: 0;
  padding: 8px 10px;
  background: #0d1117;
}

.terminal-host .xterm {
  height: 100%;
}

/* Klaviatūros mygtukai (Ctrl+C ir kt.) po terminalu */
.term-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
  max-height: 30%;
  overflow: auto;
  flex: 0 0 auto;
}

.term-key {
  padding: 3px 9px;
  font-size: 11.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  border-radius: 6px;
}

.pill.ok {
  background: #16301f;
  color: var(--ok);
}

.pill.error {
  background: #3a1d1d;
  color: var(--danger);
}

/* ----------------------------------------------------------------- servisai */

.services-shell {
  width: min(1300px, 100%);
  height: min(820px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.services-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 6px 0;
}

.services-table {
  width: 100%;
}

.services-table .label {
  font-weight: 600;
}

.services-table td.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------- serviso forma (plati) */

.modal-card.wide {
  width: min(640px, 96vw);
  max-height: 92vh;
  overflow: auto;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.form-grid label.full {
  grid-column: 1 / -1;
}

.form-grid label.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.form-grid label.check input {
  width: auto;
}

/* ------------------------------------------------------------- serviso logai */

.logs-shell {
  width: min(1200px, 100%);
  height: min(820px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.logs-body {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  overflow: auto;
  padding: 12px 14px;
  background: #0d1117;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: #cbd3e1;
}

/* ------------------------------------------------------------- unit failas */

.unit-body {
  flex: 1 1 auto;
  min-height: 0;
  resize: none;
  border: none;
  outline: none;
  background: #0d1117;
  color: #e7eaf0;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.55;
  tab-size: 4;
}