﻿:root {
  --bg: #101214;
  --surface: #171a1f;
  --surface-raised: #20242a;
  --surface-soft: #262b31;
  --border: #333940;
  --border-strong: #48515a;
  --text: #f3f5f7;
  --muted: #a7b0ba;
  --subtle: #77818c;
  --accent: #39c6b6;
  --accent-strong: #68dfd1;
  --accent-ink: #062621;
  --info: #7ab7ff;
  --danger: #ff6b73;
  --warn: #f4b860;
  --success: #58d68d;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(57, 198, 182, 0.08), rgba(57, 198, 182, 0) 260px),
    var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  letter-spacing: 0;
}

button, input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 24px;
  background: rgba(23, 26, 31, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 700;
  color: var(--text);
}

.brand span:not(.brand-mark):not(.role-dot) { color: var(--accent-strong); }

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 800;
}

.role-dot {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border: 1px solid rgba(122, 183, 255, 0.45);
  border-radius: 999px;
  color: var(--info);
  background: rgba(122, 183, 255, 0.11);
  font-size: 12px;
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.container {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 36px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.page-head h1 {
  margin: 2px 0 0;
  font-size: 28px;
  line-height: 1.15;
}

.eyebrow {
  margin: 0;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.access-pill,
.readonly-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  white-space: nowrap;
  font-weight: 800;
}

.access-pill {
  min-height: 34px;
  padding: 0 14px;
  font-size: 12px;
}

.access-pill.admin {
  color: var(--accent-ink);
  background: var(--accent);
}

.access-pill.readonly {
  color: #301f00;
  background: var(--warn);
}

.readonly-badge {
  margin-left: 8px;
  padding: 3px 8px;
  font-size: 10px;
  color: var(--warn);
  border: 1px solid rgba(244, 184, 96, 0.5);
  background: rgba(244, 184, 96, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.btn:hover {
  border-color: var(--accent);
  background: #30363d;
}

.btn:active { transform: translateY(1px); }

.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.btn.primary:hover { background: var(--accent-strong); }

.btn.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #310006;
}

.btn.small {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
  margin: 2px;
}

.btn.block { width: 100%; }

.panel {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(23, 26, 31, 0.96);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

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

.panel-head.compact { margin-bottom: 10px; }

.panel h2 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.25;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.tab:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.tab.active {
  border-color: rgba(57, 198, 182, 0.8);
  color: var(--text);
  background: rgba(57, 198, 182, 0.12);
}

.terminal-frame-wrap {
  height: 70vh;
  min-height: 520px;
  overflow: hidden;
  border: 1px solid #050607;
  border-radius: 8px;
  background: #030405;
  box-shadow: var(--shadow);
}

.terminal-frame-wrap iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}

input {
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  outline: none;
}

input::placeholder { color: var(--subtle); }

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(57, 198, 182, 0.16);
}

.field-label {
  display: block;
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.form-msg {
  min-height: 18px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #1b1f24;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  color: #dfe5ea;
  word-break: break-word;
}

tbody tr:hover { background: rgba(255, 255, 255, 0.025); }

.status-online,
.status-offline,
.status-blocked {
  font-weight: 800;
}

.status-online { color: var(--success); }
.status-offline { color: var(--subtle); }
.status-blocked { color: var(--danger); }

.login-page {
  background:
    linear-gradient(135deg, rgba(57, 198, 182, 0.12), rgba(122, 183, 255, 0.05) 36%, rgba(0, 0, 0, 0) 72%),
    var(--bg);
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(400px, 100%);
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(23, 26, 31, 0.96);
  box-shadow: var(--shadow);
}

.login-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 18px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 900;
}

.login-card h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.15;
}

.login-card p.sub {
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.login-card input {
  width: 100%;
  margin-bottom: 2px;
}

.error-msg {
  min-height: 18px;
  margin-bottom: 4px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.66);
}

.modal-backdrop.show { display: flex; }

.modal {
  width: min(420px, 100%);
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

.modal .actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  .topbar,
  .page-head,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .container {
    width: min(100% - 24px, 1480px);
    padding-top: 18px;
  }

  .page-head h1 { font-size: 24px; }

  .form-row {
    grid-template-columns: 1fr;
  }

  .terminal-frame-wrap {
    height: 68vh;
    min-height: 420px;
  }

  .login-card {
    padding: 24px;
  }
}

.form-row.wide {
  grid-template-columns: minmax(160px, 1fr) minmax(150px, 1fr) minmax(150px, 1fr) 150px 150px auto;
}
.check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-soft);
  font-weight: 700;
}
.check input { min-height: auto; }
.topbar-actions.left { justify-content: flex-start; }
@media (max-width: 1100px) {
  .form-row.wide { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .form-row.wide { grid-template-columns: 1fr; }
}
