:root {
  --bg: #10140f;
  --bg-2: #171d16;
  --panel: #1c241b;
  --line: #2d3a2a;
  --text: #e8eee4;
  --muted: #93a38c;
  --lime: #c6f355;
  --lime-2: #9ad12a;
  --warn: #f0b429;
  --danger: #ff6b4a;
  --ok: #7ee787;
  --blue: #9ecbff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 500px at 10% -10%, #2a3d1c 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: Outfit, system-ui, sans-serif;
}

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

a {
  color: inherit;
}

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

.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--lime);
  color: #172012;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.brand h1,
.brand .title {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.sub {
  color: var(--muted);
  margin: 8px 0 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 16px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  background: #12180f;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--lime-2);
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}

.btn-lime {
  background: var(--lime);
  color: #172012;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-danger {
  background: #3a1c16;
  color: #ffb4a4;
  border: 1px solid #5a2a22;
}

.btn-ssh {
  background: #172012;
  color: var(--lime);
  border: 1px solid #3d5a24;
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  background: rgba(16, 20, 15, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  gap: 8px;
}

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

.nav a.active,
.nav a:hover {
  background: var(--panel);
  color: var(--text);
}

.shell {
  padding: 22px;
  max-width: 1480px;
  margin: 0 auto;
}

.btn-ico {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}

.btn-ico .ico,
.btn-ico svg {
  width: 16px;
  height: 16px;
  display: block;
}

.btn-ico svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-actions {
  flex-wrap: nowrap;
  gap: 6px;
}

.col-actions {
  width: 1%;
  white-space: nowrap !important;
}

.col-actions .icon-actions {
  display: inline-flex;
}

.vps-table table {
  min-width: 980px;
}

.vps-table td,
.vps-table th {
  vertical-align: middle;
  white-space: nowrap;
  padding: 6px 10px;
  line-height: 1.2;
}

.vps-table tbody td {
  height: 44px;
  max-height: 44px;
}

.vps-table .btn-ico {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.vps-table .btn-ico svg {
  width: 14px;
  height: 14px;
}

.vps-table .icon-actions {
  gap: 4px;
}

.vps-table td.clip {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vps-name {
  font-weight: 600;
  letter-spacing: -0.02em;
}

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

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.stat b {
  display: block;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar input,
.toolbar select {
  min-width: 180px;
}

.grow {
  flex: 1;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card:hover {
  border-color: #4a6238;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.host {
  font-family: "IBM Plex Mono", monospace;
  color: var(--blue);
  font-size: 13px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  display: grid;
  gap: 4px;
}

.badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
}

.ok {
  background: #16341c;
  color: var(--ok);
}

.soon {
  background: #3a2d0e;
  color: var(--warn);
}

.expired {
  background: #3a1c16;
  color: var(--danger);
}

.unknown {
  background: #222;
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 500;
}

.mono {
  font-family: "IBM Plex Mono", monospace;
}

.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 40;
}

.modal {
  width: min(720px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
}

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

.span-2 {
  grid-column: span 2;
}

.err {
  color: var(--danger);
  margin-top: 10px;
}

.secret {
  background: #12180f;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

.term-page {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #0a0e09;
}

.term-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #151c13 0%, #0f140e 100%);
  border-bottom: 1px solid var(--line);
}

.term-bar-id {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.term-bar-id strong {
  font-size: 15px;
  letter-spacing: -0.03em;
}

.term-host {
  font-family: "IBM Plex Mono", monospace;
  color: var(--blue);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 999px;
  background: #12180f;
  border: 1px solid var(--line);
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.status-pill.live .dot {
  background: var(--lime);
  box-shadow: 0 0 10px var(--lime);
  animation: pulse 1.6s ease infinite;
}

.status-pill.bad .dot {
  background: var(--danger);
}

.status-pill.wait .dot {
  background: var(--warn);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 42%) 1fr;
  gap: 10px;
  padding: 10px;
}

.workspace.files-only {
  grid-template-columns: 1fr;
}

.workspace.term-only {
  grid-template-columns: 1fr;
}

.workspace.files-only .term-pane,
.workspace.term-only .files-pane {
  display: none;
}

.pane {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #101610;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

.chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: #171e15;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.traffic {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.traffic i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: block;
}

.traffic .r {
  background: #ff6b6b;
}

.traffic .y {
  background: #f0c14a;
}

.traffic .g {
  background: #7ee787;
}

.chrome-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: "IBM Plex Mono", monospace;
}

.term-body {
  min-height: 0;
  background: #0b0f0a;
  padding: 6px 8px 10px;
}

#terminal {
  height: 100%;
  background: #0b0f0a;
}

.xterm,
.xterm-viewport {
  height: 100%;
}

.xterm .xterm-viewport {
  overflow-y: auto;
}

.files-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: #141b12;
  flex-wrap: wrap;
}

.crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  min-width: 0;
  flex: 1;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

.crumb button {
  background: transparent;
  border: 0;
  color: var(--blue);
  padding: 2px 4px;
  border-radius: 6px;
  cursor: pointer;
}

.crumb button:hover {
  background: #1d2819;
  color: var(--text);
}

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

.file-list {
  overflow: auto;
  min-height: 0;
}

.file-row {
  display: grid;
  grid-template-columns: 28px 1fr 90px 140px;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid #1c2519;
  cursor: pointer;
  font-size: 13px;
}

.file-row:hover,
.file-row.sel {
  background: #1a2417;
}

.file-row.sel {
  outline: 1px solid #3d5a24;
}

.file-ico {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 12px;
  background: #1c2818;
}

.file-row.dir .file-ico {
  background: #24351b;
  color: var(--lime);
}

.file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size,
.file-time {
  color: var(--muted);
  font-size: 12px;
  font-family: "IBM Plex Mono", monospace;
}

.files-pane {
  position: relative;
}

.file-drop.over::after {
  content: "Thả file để upload";
  position: absolute;
  inset: 8px;
  border: 1px dashed var(--lime-2);
  border-radius: 12px;
  background: rgba(198, 243, 85, 0.08);
  display: grid;
  place-items: center;
  color: var(--lime);
  font-weight: 600;
  pointer-events: none;
}

.editor-wrap {
  position: absolute;
  inset: 0;
  background: #0f140e;
  display: grid;
  grid-template-rows: auto 1fr auto;
  z-index: 2;
}

.editor-wrap textarea {
  border: 0;
  border-radius: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  line-height: 1.5;
  min-height: 0;
  height: 100%;
}

.btn-sm {
  padding: 7px 10px;
  font-size: 12px;
}

.seg {
  display: flex;
  background: #12180f;
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
}

.seg button {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 7px 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
}

.seg button.on {
  background: #22331b;
  color: var(--lime);
}

@media (max-width: 960px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
  .file-row {
    grid-template-columns: 28px 1fr 80px;
  }
  .file-time {
    display: none;
  }
}

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

.actions.icon-actions {
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
}

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

@media (max-width: 860px) {
  .stats,
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
  .span-2,
  .form-grid .field {
    grid-column: span 2;
  }
  .top {
    flex-wrap: wrap;
  }
}

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