:root {
  --bg-main: #0f111a;
  --bg-card: #181a27;
  --bg-card-hover: #202334;
  --bg-input: #272a3e;
  --accent: #7aa2f7;
  --accent-hover: #89b4fa;
  --success: #9ece6a;
  --danger: #f7768e;
  --warning: #e0af68;
  --text-main: #c0caf5;
  --text-muted: #7982a9;
  --border: #292e42;
  --radius: 12px;
  --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.navbar {
  background: rgba(24, 26, 39, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
  flex: 1;
}

/* Grid System */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  border-color: rgba(122, 162, 247, 0.4);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-online {
  background: rgba(158, 206, 106, 0.15);
  color: var(--success);
  border: 1px solid rgba(158, 206, 106, 0.3);
}

.badge-offline {
  background: rgba(247, 118, 142, 0.15);
  color: var(--danger);
  border: 1px solid rgba(247, 118, 142, 0.3);
}

.badge-locked {
  background: rgba(224, 175, 104, 0.15);
  color: var(--warning);
  border: 1px solid rgba(224, 175, 104, 0.3);
}

.active-window-title {
  color: var(--accent);
  font-family: monospace;
  font-size: 0.95rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.process-help, .process-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.process-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

.process-mode { max-width: 520px; text-align: left; margin-bottom: 1rem; }
.process-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.process-columns h4 { margin: 0 0 0.6rem; }
.process-list { min-height: 90px; max-height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem; }
.process-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.4rem; border-bottom: 1px solid var(--border); }
.process-row:last-child { border-bottom: 0; }
.process-name { min-width: 0; overflow-wrap: anywhere; }
.process-pid { color: var(--text-muted); font-size: 0.75rem; }
.process-action { padding: 0.25rem 0.55rem; font-size: 0.78rem; flex-shrink: 0; }
.process-add-row { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; margin-top: 0.6rem; }
.process-events { min-height: 45px; max-height: 180px; }

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

/* Progress Bar */
.progress-container {
  margin: 1rem 0;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.progress-bar-bg {
  background: var(--bg-input);
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
}

.progress-bar-fill {
  background: linear-gradient(90deg, var(--accent), var(--success));
  height: 100%;
  width: 0%;
  transition: width 0.4s ease;
}

/* Action Buttons */
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.btn {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: background-color 0.2s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #0f111a;
}
.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-danger {
  background: var(--danger);
  color: #0f111a;
}

.btn-success {
  background: var(--success);
  color: #0f111a;
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
}

/* Schedule Table */
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.schedule-table th, .schedule-table td {
  padding: 0.6rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.schedule-table th {
  color: var(--text-muted);
  font-weight: 600;
}

.schedule-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  font-size: 0.85rem;
  width: 100%;
  text-align: center;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  max-width: 500px;
  width: 100%;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.telegram-account-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
}

.telegram-account-row small {
    display: block;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.pairing-help, .pairing-option p {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.pairing-setup label:first-child {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.pairing-setup .schedule-input {
  text-align: left;
  padding: 0.65rem;
}

.pairing-checkbox {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.9rem 0 0.4rem;
  cursor: pointer;
}

.pairing-checkbox input {
  width: 1rem;
  height: 1rem;
}

.pairing-code-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.pairing-code {
  font-size: 2rem;
  letter-spacing: 0.35rem;
  color: var(--success);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
}

.pairing-option {
  border-top: 1px solid var(--border);
  margin-top: 1.25rem;
  padding-top: 1.1rem;
}

.pairing-option h4 { margin-bottom: 0.5rem; }

.pairing-command {
  width: 100%;
  min-height: 5.5rem;
  resize: vertical;
  padding: 0.75rem;
  margin: 0.65rem 0;
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: monospace;
  line-height: 1.4;
}

.pairing-status.ready { color: var(--success); }
.pairing-status.warning { color: var(--warning); }

/* Live Screen Modal */
.screen-img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-top: 0.5rem;
}

.nav-link {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.nav-link:hover { color: var(--accent); }
.brand-logo { width: 34px; height: 34px; object-fit: contain; }
.login-logo { width: 92px; height: 92px; object-fit: contain; filter: drop-shadow(0 10px 22px rgba(36, 166, 255, 0.22)); }

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.status-value { font-size: 1.6rem; font-weight: 700; margin-top: 0.4rem; }
.status-healthy { color: var(--success); }
.status-warning { color: var(--warning); }
.status-muted { color: var(--text-muted); }
.admin-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.admin-table th, .admin-table td { padding: 0.7rem; border-bottom: 1px solid var(--border); text-align: left; }

.help-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 1rem; align-items: start; }
.help-nav { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 0.65rem; }
.help-nav a { color: var(--text-muted); text-decoration: none; }
.help-nav a:hover { color: var(--accent); }
.help-content { line-height: 1.65; }
.help-content h1 { color: var(--accent); margin-bottom: 1rem; }
.help-content h2 { color: var(--text-main); margin: 1.7rem 0 0.65rem; scroll-margin-top: 1rem; }
.help-content ul, .help-content ol { padding-left: 1.4rem; }
.help-content li { margin-bottom: 0.35rem; }

.release-layout { max-width: 1050px; }
.release-heading { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.release-heading h1 { color: var(--accent); margin: 0; }
.release-hero p { margin-top: 0.65rem; }
.release-downloads { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.download-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 0.8rem; }
.download-card.recommended { border-color: var(--accent); }
.download-label { position: absolute; right: 1rem; top: 1rem; color: var(--success); font-size: 0.8rem; font-weight: 700; }
.artifact-meta { color: var(--text-muted); font-size: 0.85rem; }
.release-hash { width: 100%; overflow-wrap: anywhere; color: var(--text-muted); font-size: 0.75rem; }
.release-notes { line-height: 1.6; }
.release-notes ol, .release-notes ul { padding-left: 1.4rem; }
.changelog-entry { border-top: 1px solid var(--border); padding-top: 1rem; margin-top: 1rem; }
.changelog-entry h3, .changelog-entry h4 { margin-bottom: 0.45rem; }

@media (max-width: 600px) {
  .navbar { padding: 0.75rem 1rem; }
  .container { padding: 1rem 0.75rem; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .help-layout { grid-template-columns: 1fr; }
  .help-nav { position: static; }
  .release-downloads { grid-template-columns: 1fr; }
}
