:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #333333;
  --text-soft: #5c5c5c;
  --muted: #b3b3b3;
  --border: rgba(0, 0, 0, 0.1);
  --accent: #ff3333;
  --accent-hover: #e62e2e;
  --navy: #1a1a1a;
  --success-bg: #f0fdf4;
  --success-text: #166534;
  --error-bg: #fef2f2;
  --error-text: #b91c1c;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

h1,
h2 {
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--navy);
}

.page-auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
  background: linear-gradient(180deg, #fff 0%, var(--bg) 100%);
}

.auth-card {
  width: min(420px, 100%);
  padding: 2rem 2rem 2.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 0.35rem 0 0.5rem;
  font-size: 1.5rem;
}

.shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.topbar-brand {
  min-width: 0;
}

.topbar h1 {
  margin: 0.25rem 0 0;
  font-size: 1.65rem;
}

.eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.muted.small {
  font-size: 0.85rem;
  color: var(--muted);
}

.content {
  max-width: 920px;
  margin: 0 auto;
  padding: 1.5rem 2rem 2.5rem;
}

.grid {
  display: grid;
  gap: 1.25rem;
}

.project-card {
  padding: 1.35rem 1.5rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.project-card:hover {
  border-color: rgba(255, 51, 51, 0.22);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
}

.project-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.project-card h2 {
  margin: 0;
  font-size: 1.15rem;
}

.project-card h2 a {
  color: var(--navy);
  text-decoration: none;
}

.project-card h2 a:hover {
  color: var(--accent);
}

.badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--success-bg);
  color: var(--success-text);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}

.url-line {
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

.url-line a {
  font-weight: 500;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

input,
textarea {
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: rgba(255, 51, 51, 0.45);
  box-shadow: 0 0 0 3px rgba(255, 51, 51, 0.12);
}

textarea {
  resize: vertical;
  min-height: 7rem;
  line-height: 1.5;
}

.notes-form {
  margin-top: 0.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.notes-form .form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.65rem;
  flex-wrap: wrap;
}

button,
.btn {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: none;
  padding: 0.6rem 1.1rem;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  box-sizing: border-box;
}

a.btn:hover {
  text-decoration: none;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
}

.btn-primary,
button.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

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

.btn-secondary,
button.btn-secondary {
  background: var(--surface);
  color: var(--navy);
  border: 1px solid var(--border);
}

.btn-secondary:hover,
a.btn-secondary:hover {
  border-color: rgba(255, 51, 51, 0.35);
  background: #fff5f5;
  color: var(--navy);
}

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

.btn-ghost:hover,
a.btn-ghost:hover {
  border-color: var(--muted);
  color: var(--text);
  background: #fafafa;
}

.btn.is-active {
  border-color: rgba(255, 51, 51, 0.45);
  background: #fff5f5;
  color: var(--accent);
}

.error {
  color: var(--error-text);
  background: var(--error-bg);
  border: 1px solid #fecaca;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
}

.banner-error {
  max-width: 920px;
  margin: 1rem auto 0;
  padding: 0 2rem;
}

.admin-service-link {
  margin: 0 auto 1.25rem;
  max-width: 920px;
  padding: 0 2rem;
  font-size: 0.95rem;
}

.admin-service-link a {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.admin-service-link a:hover {
  text-decoration: underline;
}

.toast {
  margin: 1rem auto 0;
  max-width: 920px;
  padding: 0 2rem;
  box-sizing: border-box;
  padding: 0.7rem 1rem;
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  font-size: 0.9rem;
}

.empty-state {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.file-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.file-list li {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.file-list li:last-child {
  border-bottom: none;
}

.file-list code {
  font-size: 0.88em;
  color: var(--navy);
}

.hint-box {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: #fff8f8;
  border: 1px solid rgba(255, 51, 51, 0.15);
  border-radius: 8px;
  font-size: 0.9rem;
}

.hint-box a {
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.topbar-form {
  margin: 0;
  display: inline-flex;
}

.topbar-user {
  font-size: 0.9rem;
  color: var(--text-soft);
  font-weight: 500;
  padding: 0 0.25rem;
}

.access-panel {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.access-title {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.access-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

.access-row:last-child {
  border-bottom: none;
}

.access-name code {
  font-size: 0.85em;
  font-weight: 500;
}

.access-perms {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.perm-chip {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
}

.perm-chip.perm-ssh {
  background: #ecfdf5;
  color: #047857;
}

.perm-chip.perm-docker {
  background: #fff7ed;
  color: #c2410c;
}

.card-admin-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.section-title {
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
}

.log-block {
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.content-narrow {
  max-width: 640px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table th {
  background: #f5f5f5;
  font-weight: 600;
  color: var(--navy);
}

.data-table.compact td label {
  margin: 0;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
}

.content.narrow,
main.content .content-narrow {
  max-width: 640px;
}

.create-project-panel {
  margin-bottom: 2rem;
  max-width: none;
}

.form-grid-2 {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .form-grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.is-hidden {
  display: none !important;
}

.perm-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.5rem;
}

.user-create-fieldset {
  margin-top: 0.25rem;
}

.card-form {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card-form fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem 1rem;
  margin: 0;
}

.deploy-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.ssh-box {
  padding: 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.code-block {
  margin: 0.5rem 0 0;
  padding: 0.65rem 0.75rem;
  background: var(--navy);
  color: #f1f5f9;
  border-radius: 6px;
  font-size: 0.82rem;
  overflow-x: auto;
}

.badge.muted {
  opacity: 0.65;
}

@media (max-width: 640px) {
  .topbar,
  .content {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .toast {
    margin-left: 1.25rem;
    margin-right: 1.25rem;
  }
}
