/* DockerSite — дизайн-система (тёмная тема) */

:root {
  --bg: #0e1216;
  --panel: #161c23;
  --panel2: #1d2630;
  --border: #263241;
  --text: #e8ecf1;
  --muted: #93a1b3;
  --accent: #4f8cff;
  --accent2: #3d76e0;
  --green: #3fbf7f;
  --red: #e5534b;
  --amber: #e2a336;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

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

h1 { font-size: 22px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 6px; }
h3 { font-size: 15px; margin: 0 0 4px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a3646; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #35455a; }

/* ---------- layout ---------- */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex: 0 0 220px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  padding: 4px 10px 16px;
}
.logo svg { flex: 0 0 auto; }
.logo .ver { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  border-left: 2px solid transparent;
  user-select: none;
}
.nav-item:hover { color: var(--text); background: var(--panel2); }
.nav-item.active {
  color: var(--text);
  background: var(--panel2);
  border-left-color: var(--accent);
}
.nav-item svg { flex: 0 0 auto; opacity: .9; }

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar h1 { font-size: 17px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar .user { color: var(--muted); }

.content {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  flex: 1;
}

.content.bare { display: flex; align-items: center; justify-content: center; min-height: 100vh; max-width: none; }

/* ---------- карточки ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.card h2 { margin-bottom: 10px; }
.card-sub { color: var(--muted); font-size: 12.5px; margin: 0 0 12px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-card .num { font-size: 26px; font-weight: 700; }
.stat-card .num small { font-size: 13px; color: var(--muted); font-weight: 400; }
.stat-card .label { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------- кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  transition: background .12s, border-color .12s, opacity .12s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent2); }
.btn.danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn.danger:hover { background: rgba(229, 83, 75, .12); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 12.5px; border-radius: 6px; }

.btn.loading { pointer-events: none; opacity: .75; }
.btn.loading::after {
  content: '';
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn.loading { position: relative; }
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}

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

/* ---------- таблицы ---------- */

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(38, 50, 65, .55);
  vertical-align: middle;
}
.table tr:hover td { background: rgba(29, 38, 48, .5); }
.table .row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- бейджи / пилюли ---------- */

.badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 20px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.green { background: rgba(63, 191, 127, .13); color: var(--green); border-color: rgba(63, 191, 127, .35); }
.badge.red { background: rgba(229, 83, 75, .13); color: var(--red); border-color: rgba(229, 83, 75, .35); }
.badge.amber { background: rgba(226, 163, 54, .13); color: var(--amber); border-color: rgba(226, 163, 54, .35); }
.badge.blue { background: rgba(79, 140, 255, .13); color: var(--accent); border-color: rgba(79, 140, 255, .35); }
.badge.gray { background: rgba(147, 161, 179, .12); color: var(--muted); border-color: rgba(147, 161, 179, .3); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.green { background: rgba(63, 191, 127, .13); color: var(--green); border-color: rgba(63, 191, 127, .35); }
.pill.red { background: rgba(229, 83, 75, .13); color: var(--red); border-color: rgba(229, 83, 75, .35); }

/* ---------- табы ---------- */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
}
.tab {
  padding: 9px 14px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
  font-size: 13.5px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- формы ---------- */

.input, .select, .textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color .12s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.textarea { resize: vertical; min-height: 90px; }
.textarea.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12.5px; }

.form-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin: 12px 0 4px;
}
.form-row { margin-bottom: 10px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .slider {
  width: 36px;
  height: 20px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 20px;
  position: relative;
  transition: background .15s;
  flex: 0 0 auto;
}
.switch .slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: left .15s, background .15s;
}
.switch input:checked + .slider { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .slider::after { left: 18px; background: #fff; }
.switch .switch-label { color: var(--text); font-size: 13.5px; }

/* ---------- модалки / тосты ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 7vh 16px 16px;
  overflow-y: auto;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.modal.wide { max-width: 920px; }
.modal-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 0;
  font-weight: 600;
  font-size: 15px;
}
.modal-body { padding: 12px 18px 4px; max-height: 70vh; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; }
.modal-close { border: none; }

.toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}
.toast {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  word-break: break-word;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.info { border-left-color: var(--accent); }
.toast.amber { border-left-color: var(--amber); }

.confirm-text { line-height: 1.55; }

/* ---------- прочее ---------- */

.kv { width: 100%; border-collapse: collapse; }
.kv td { padding: 7px 8px; border-bottom: 1px solid rgba(38, 50, 65, .5); vertical-align: top; }
.kv td:first-child { color: var(--muted); width: 200px; }
.kv tr:last-child td { border-bottom: none; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 42px 16px;
}
.empty svg { opacity: .4; margin-bottom: 10px; }

.breadcrumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; color: var(--muted); font-size: 13px; }
.breadcrumbs a { cursor: pointer; }
.breadcrumbs .sep { opacity: .5; }
.breadcrumbs .current { color: var(--text); }

pre.codeblock {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 12px;
  overflow: auto;
  max-height: 60vh;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
pre.codeblock.raw { white-space: pre; }

.banner {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13.5px;
  border: 1px solid;
}
.banner.red { background: rgba(229, 83, 75, .1); border-color: rgba(229, 83, 75, .4); color: #f0908a; }
.banner.amber { background: rgba(226, 163, 54, .1); border-color: rgba(226, 163, 54, .4); color: var(--amber); }
.banner.green { background: rgba(63, 191, 127, .1); border-color: rgba(63, 191, 127, .4); color: var(--green); }

.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }

/* шапка сайта */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.site-header .left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.site-header .badges { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.site-header .urls { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* файловый менеджер */
.fm-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.fm-name { cursor: pointer; }
.fm-name:hover { text-decoration: underline; }
.fm-icon { vertical-align: -2px; margin-right: 7px; opacity: .8; }

/* права доступа (chmod) */
.chmod-presets { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 4px; }
.chmod-grid { display: flex; gap: 22px; margin-top: 12px; flex-wrap: wrap; }
.chmod-who { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.chmod-check { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; cursor: pointer; font-family: ui-monospace, monospace; }
.chmod-check input { accent-color: var(--accent); }

/* SSL-вкладка */
.ssl-details { margin: 0; }
.ssl-details > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  padding: 2px 0;
  color: var(--text);
}
.ssl-details > summary:hover { color: var(--accent); }
.ssl-details > *:not(summary) { margin-top: 10px; }

/* drag&drop и прогресс загрузки */
.filemanager { transition: border-color .12s, box-shadow .12s; }
#fm-zone.fm-drag-over {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(79, 140, 255, .25);
}
.fm-drop-hint { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
#fm-zone.fm-drag-over .fm-drop-hint { color: var(--accent); }
.fm-progress { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; background: var(--bg); }
.fm-progress-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 7px; flex-wrap: wrap; }
.fm-progress-track { height: 7px; border-radius: 6px; background: var(--panel2); overflow: hidden; }
.fm-progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .15s linear; }
.fm-progress-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; max-height: 96px; overflow: auto; }
.fm-progress-item {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--muted);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fm-progress-item.ok { color: var(--green); border-color: rgba(63, 191, 127, .35); }

/* логи */
.logs-panes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .logs-panes { grid-template-columns: 1fr; } }
.logs-panes h3 { margin-bottom: 8px; }

/* логин */
.auth-wrap { width: 100%; max-width: 400px; margin: 0 auto; }
.auth-card { padding: 28px; }
.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 20px;
  justify-content: center;
  margin-bottom: 8px;
}
.auth-card .btn { width: 100%; margin-top: 18px; }

.term-host {
  height: 55vh;
  background: var(--bg);
  border-radius: 8px;
  padding: 6px;
  overflow: hidden;
}

.term-sub {
  color: var(--muted);
  font-size: 12.5px;
  margin-bottom: 8px;
  word-break: break-all;
}

/* панель шаблонов rsync над терминалом */
.term-templates {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  padding: 10px 12px;
  margin-bottom: 10px;
  max-height: 34vh;
  overflow-y: auto;
}
.term-templates-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  margin-bottom: 6px;
}
.term-template-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.term-template {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.term-template:hover { border-color: var(--accent); }
.term-template code {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 11.5px;
  color: var(--accent);
  word-break: break-all;
}
.term-template-label { font-weight: 600; }
.term-template-hint { font-size: 11.5px; line-height: 1.35; }

/* ---------- адаптив ---------- */

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex: none;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 8px 12px;
  }
  .logo { padding: 0 10px 0 0; }
  .nav-item { white-space: nowrap; border-left: none; border-bottom: 2px solid transparent; }
  .nav-item.active { border-bottom-color: var(--accent); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .content { padding: 14px; }
  .topbar { padding: 12px 14px; }
}

/* ---------- дашборд ---------- */

.alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }

.banner.blue { background: rgba(79, 140, 255, .1); border-color: rgba(79, 140, 255, .4); color: var(--accent); }

.stat-card.clickable { cursor: pointer; transition: border-color .12s; }
.stat-card.clickable:hover { border-color: var(--accent); }
.stat-card .sub { color: var(--muted); font-size: 12px; margin-top: 6px; }

.dash-split {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}
.dash-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 1100px) { .dash-split { grid-template-columns: 1fr; } }

.dash-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.dash-card-head h2 { margin: 0; }

.kpi-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}

.meter {
  height: 7px;
  border-radius: 6px;
  background: var(--panel2);
  overflow: hidden;
  margin-top: 7px;
}
.meter-fill {
  height: 100%;
  border-radius: 6px;
  background: var(--accent);
  transition: width .2s;
}
.meter-fill.green { background: var(--green); }
.meter-fill.amber { background: var(--amber); }
.meter-fill.red { background: var(--red); }

.mini-table th { padding: 8px 10px; }
.mini-table td { padding: 8px 10px; vertical-align: top; }

