/* Proxmer — минималистичная тема */
:root {
  --bg:        #ffffff;
  --surface:   #f5f5f5;
  --surface2:  #ebebeb;
  --border:    #e0e0e0;
  --text:      #1a1a1a;
  --text-muted:#6b7280;
  --accent:    #2563eb;
  --accent-hover: #1d4ed8;
  --danger:    #dc2626;
  --success:   #16a34a;
  --warning:   #d97706;
  --radius:    8px;
  --shadow:    0 1px 3px rgba(0,0,0,.08);
  --transition: 150ms ease;
}

[data-theme="dark"] {
  --bg:        #0f0f0f;
  --surface:   #1a1a1a;
  --surface2:  #252525;
  --border:    #2e2e2e;
  --text:      #f0f0f0;
  --text-muted:#9ca3af;
  --accent:    #3b82f6;
  --accent-hover: #60a5fa;
  --shadow:    0 1px 3px rgba(0,0,0,.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

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

/* Layout */
.app { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  letter-spacing: -.3px;
}

.topbar-nav { display: flex; gap: 4px; flex: 1; }

.topbar-burger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
}
.topbar-burger:hover { background: var(--surface2); }

.nav-link {
  padding: 5px 10px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border: none;
  background: none;
}
.nav-link:hover, .nav-link.active {
  background: var(--surface2);
  color: var(--text);
}

.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.main { flex: 1; padding: 24px 20px; max-width: 1200px; margin: 0 auto; width: 100%; }

/* Mobile topbar — collapse nav into a dropdown drawer */
@media (max-width: 768px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar-burger { display: inline-flex; align-items: center; justify-content: center; }
  .topbar-nav {
    display: none;
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 6px;
    z-index: 99;
  }
  .topbar-nav.open { display: flex; }
  .topbar-nav .nav-link {
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    font-size: 15px;
    border-radius: var(--radius);
  }
  .topbar-actions span { display: none; } /* hide username, keep theme+logout */
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title { font-weight: 600; font-size: 15px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition), opacity var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--border); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--surface2); color: var(--text); }

.btn-sm { padding: 3px 10px; font-size: 12px; }
.btn-icon { padding: 5px; }

/* Forms */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.form-input, .form-select, .form-textarea {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--transition);
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.form-hint { font-size: 12px; color: var(--text-muted); }
.form-error { font-size: 12px; color: var(--danger); }

/* Grid */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 800px) {
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topbar-nav { display: none; }
}

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
th { font-weight: 500; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
tr:hover td { background: var(--surface2); }

/* Badge / Status */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.badge-running  { background: #dcfce7; color: #15803d; }
.badge-stopped  { background: var(--surface2); color: var(--text-muted); }
.badge-suspended{ background: #fef9c3; color: #a16207; }
.badge-unknown  { background: var(--surface2); color: var(--text-muted); }

[data-theme="dark"] .badge-running  { background: #14532d; color: #86efac; }
[data-theme="dark"] .badge-stopped  { background: var(--surface2); color: var(--text-muted); }
[data-theme="dark"] .badge-suspended{ background: #422006; color: #fde68a; }

/* Progress bar */
.progress { background: var(--surface2); border-radius: 999px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s ease; }

/* Stat card */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -.5px; }
.stat-label { font-size: 12px; color: var(--text-muted); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 16px;
}
.modal-backdrop.hidden { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}
.modal-lg { max-width: 760px; }
.modal-full { max-width: 100%; height: 90vh; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-weight: 600; font-size: 15px; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 16px; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Toast */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 300;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  animation: toast-in .2s ease;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast-success { background: var(--success); color: #fff; }
.toast-error   { background: var(--danger);  color: #fff; }
.toast-info    { background: var(--accent);  color: #fff; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Spinner */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-title  { font-size: 20px; font-weight: 700; }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.breadcrumb-sep { color: var(--border); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-title { font-size: 15px; font-weight: 500; margin-bottom: 8px; color: var(--text); }

/* Divider */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}
.tab-btn.active, .tab-btn:hover { color: var(--text); }
.tab-btn.active { border-bottom-color: var(--accent); }

/* Console terminal */
.terminal-wrap {
  background: #0f0f0f;
  border-radius: var(--radius);
  padding: 8px;
  flex: 1;
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

/* Quota bar */
.quota-item { display: flex; flex-direction: column; gap: 4px; }
.quota-label { display: flex; justify-content: space-between; font-size: 12px; }
.quota-name { color: var(--text-muted); }
.quota-value { color: var(--text); font-weight: 500; }

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-card {
  width: 360px;
  padding: 32px;
}
.login-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}
.login-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Wizard steps */
.steps { display: flex; gap: 0; margin-bottom: 24px; }
.step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
}
.step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 12px;
  left: 50%;
  width: 100%;
  height: 1px;
  background: var(--border);
}
.step.done::after, .step.active::after { background: var(--accent); }
.step-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 600;
  z-index: 1;
  color: var(--text-muted);
}
.step.active .step-dot { border-color: var(--accent); color: var(--accent); }
.step.done  .step-dot  { border-color: var(--accent); background: var(--accent); color: #fff; }
.step-label { font-size: 11px; color: var(--text-muted); text-align: center; }
.step.active .step-label { color: var(--text); font-weight: 500; }

/* Misc */
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* Fieldset and checkboxes */
.fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
  background: var(--surface);
}
.fieldset legend {
  font-weight: 600;
  font-size: 13px;
  padding: 0 8px;
  color: var(--text);
  margin-left: -8px;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  padding: 8px 0;
  user-select: none;
}
.form-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}
.form-checkbox span {
  flex: 1;
}

/* VM Detail header */
.vm-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.vm-header-left { flex: 1; }
.vm-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

/* Control row */
.vm-actions-row { flex-shrink: 0; }
.vm-ctrl-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.vm-ctrl-sep {
  width: 1px;
  height: 34px;
  background: var(--border);
  margin: 0 4px;
}

/* Icon-only square buttons — uniform height, glowing outline */
.icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.icon-btn:hover {
  background: var(--surface2);
  border-color: var(--accent);
}
.icon-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* Glow variants — inset glow only, no fill */
.icon-btn.glow-success {
  border-color: var(--success);
  box-shadow: inset 0 0 6px -2px var(--success);
}
.icon-btn.glow-success:hover {
  box-shadow: inset 0 0 8px -1px var(--success);
}
.icon-btn.glow-warning {
  border-color: var(--warning);
  box-shadow: inset 0 0 6px -2px var(--warning);
}
.icon-btn.glow-warning:hover {
  box-shadow: inset 0 0 8px -1px var(--warning);
}
.icon-btn.glow-danger {
  border-color: var(--danger);
  box-shadow: inset 0 0 6px -2px var(--danger);
}
.icon-btn.glow-danger:hover {
  box-shadow: inset 0 0 8px -1px var(--danger);
}

/* btn-success */
.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover { background: #15803d; border-color: #15803d; }

/* btn-warning */
.btn-warning {
  background: var(--warning);
  color: #fff;
  border-color: var(--warning);
}
.btn-warning:hover { background: #b45309; border-color: #b45309; }

.btn-icon { margin-right: 3px; }

/* Stats bar */
.vm-stats-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.stat-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  min-width: 120px;
  flex: 1;
}
.stat-pill-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.stat-pill-val {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}
.stat-pill-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.stat-pill-bar div {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}

@media (max-width: 600px) {
  .vm-header { flex-direction: column; }
  .vm-stats-bar { flex-direction: column; }
  .stat-pill { min-width: unset; }
  .btn-label { display: none; }
}

/* Storage management */
.storage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding-top: 4px;
}
.storage-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--bg);
}
.storage-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.storage-card-link:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.storage-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.storage-card-name {
  font-weight: 600;
  font-size: 14px;
}
.storage-card-type {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.storage-card-usage {}
.storage-usage-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}
.storage-usage-bar div {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}
.storage-usage-text {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* Edit page */
.edit-sections { display: flex; flex-direction: column; gap: 16px; }
.edit-section { }

/* Alert */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid transparent;
}
.alert-warning {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}
[data-theme="dark"] .alert-warning {
  background: #292011;
  border-color: #854d0e;
  color: #fcd34d;
}
