* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f1115;
  color: #e6e6e6;
  min-height: 100vh;
}

.center-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  background: #171a21;
  border: 1px solid #2a2e38;
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 380px;
}

.card h1 {
  margin-top: 0;
  font-size: 1.4rem;
}

label {
  display: block;
  margin: 14px 0 6px;
  font-size: 0.85rem;
  color: #a8adb8;
}

input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #2a2e38;
  background: #0f1115;
  color: #e6e6e6;
  font-size: 0.95rem;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
}

.btn-primary {
  background: #4f7cff;
  color: white;
  width: 100%;
  margin-top: 20px;
}

.btn-secondary {
  background: transparent;
  color: #4f7cff;
  border: 1px solid #4f7cff;
}

.btn-danger {
  background: #ff4f4f;
  color: white;
}

.toggle-link {
  text-align: center;
  margin-top: 16px;
  font-size: 0.85rem;
  color: #a8adb8;
}

.toggle-link a {
  color: #4f7cff;
  cursor: pointer;
  text-decoration: underline;
}

.error-text {
  color: #ff6b6b;
  font-size: 0.85rem;
  min-height: 1.2em;
  margin-top: 8px;
}

.dashboard {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px;
}

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

.dashboard-header h1 {
  font-size: 1.3rem;
  margin: 0;
}

section {
  background: #171a21;
  border: 1px solid #2a2e38;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

section h2 {
  margin-top: 0;
  font-size: 1.05rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #2a2e38;
}

th {
  color: #a8adb8;
  font-weight: 600;
}

.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 16px;
}

.inline-form > div {
  display: flex;
  flex-direction: column;
}

.inline-form label {
  margin: 0 0 4px;
}

.inline-form input {
  width: 160px;
}

.row-actions button {
  margin-right: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
}

td button {
  padding: 4px 10px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.pagination button {
  padding: 4px 12px;
  font-size: 0.8rem;
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-label {
  color: #a8adb8;
  font-size: 0.82rem;
}

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-running {
  background: #1f4d2e;
  color: #7be59a;
}

.status-error {
  background: #4d1f1f;
  color: #ff8f8f;
}

.status-stopped {
  background: #3a3f4d;
  color: #c3c9d6;
}

.navbar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.navbar a {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  color: #a8adb8;
  text-decoration: none;
  border: 1px solid #2a2e38;
}

.navbar a.active {
  background: #4f7cff;
  color: white;
  border-color: #4f7cff;
}

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

.port-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 12px 0;
  max-width: 220px;
}

.env-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}

.env-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
}

.remove-env {
  width: 42px;
  padding: 0;
  font-size: 1.1rem;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.panel {
  background: #0f1115;
  border: 1px solid #2a2e38;
  border-radius: 12px;
  padding: 14px;
}

.panel h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.log-box {
  margin: 0;
  min-height: 280px;
  max-height: 420px;
  overflow: auto;
  color: #e6e6e6;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
}

.docker-command-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.docker-command-list li {
  padding: 8px 10px;
  border-radius: 8px;
  background: #1a2740;
  color: #8fc4ff;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.82rem;
  word-break: break-word;
}

.status-line {
  margin-top: 16px;
  padding: 10px 14px;
  background: #0f1115;
  border: 1px solid #2a2e38;
  border-radius: 10px;
  color: #a8adb8;
  font-size: 0.9rem;
}

@media (max-width: 700px) {
  .center-page {
    padding: 12px;
  }

  .card {
    padding: 24px 18px;
    max-width: 100%;
  }

  .dashboard {
    padding: 20px 12px;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .navbar {
    flex-wrap: wrap;
  }

  section {
    padding: 14px;
  }

  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-form input {
    width: 100%;
  }

  .port-fields {
    max-width: 100%;
  }

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

  .panel-grid {
    grid-template-columns: 1fr;
  }

  th, td {
    padding: 6px 8px;
    font-size: 0.82rem;
  }
}
