*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0d0f11; --surface: #13161a; --surface2: #181c21;
  --border: #1e2328; --border-lit: #2a3140;
  --text: #c9d1d9; --muted: #6e7681;
  --accent: #58a6ff; --green: #3fb950; --red: #f85149;
  --yellow: #d29922; --orange: #e3893d;
  --mono: 'IBM Plex Mono', monospace; --sans: 'IBM Plex Sans', sans-serif;
}
body { background: var(--bg); color: var(--text); font-family: var(--sans); min-height: 100vh; }

/* Screen reader utilities */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.sr-skip {
  position: absolute; left: -999px; top: auto; width: 1px; height: 1px; overflow: hidden;
  z-index: 999; padding: 8px 16px; background: var(--accent); color: var(--bg);
  font-family: var(--mono); font-size: 13px; font-weight: 600; text-decoration: none; border-radius: 4px;
}
.sr-skip:focus {
  position: fixed; left: 16px; top: 16px; width: auto; height: auto; overflow: visible;
}

header {
  border-bottom: 1px solid var(--border); padding: 0 32px; height: 56px;
  display: flex; align-items: center; gap: 20px;
  position: sticky; top: 0; background: var(--bg); z-index: 20;
}
h1.logo { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .1em; color: var(--accent); text-transform: uppercase; }
h1.logo em { color: var(--muted); font-style: normal; }
.header-meta { font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .06em; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.btn-logout {
  text-decoration: none; display: inline-flex; align-items: center;
  color: var(--muted); border-color: var(--border);
}
.btn-logout:hover { color: var(--text); }

button {
  cursor: pointer; font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: .04em; border: 1px solid transparent; border-radius: 4px;
  padding: 5px 11px; transition: background .12s, opacity .12s, transform .1s; white-space: nowrap;
}
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button:active { transform: scale(.96); }
button:disabled { opacity: .3; cursor: not-allowed; transform: none; }
.btn-ghost { background: var(--surface2); border-color: var(--border-lit); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--border-lit); }
.btn-start   { background: #152a1c; color: var(--green);  border-color: #1e3d28; }
.btn-stop    { background: #2a1515; color: var(--red);    border-color: #3d1e1e; }
.btn-restart { background: #132033; color: var(--accent); border-color: #1e3050; }
.btn-pull    { background: #231d12; color: var(--yellow); border-color: #382d1a; }
.btn-start:hover:not(:disabled)   { background: #1a3824; }
.btn-stop:hover:not(:disabled)    { background: #38181a; }
.btn-restart:hover:not(:disabled) { background: #182840; }
.btn-pull:hover:not(:disabled)    { background: #2e2516; }

main { padding: 28px 32px; max-width: 1280px; margin: 0 auto; }
h2.section-label { font-family: var(--mono); font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; margin-bottom: 16px; }

/* Data table — styled to keep the card-row aesthetic */
.container-table { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
.container-table thead th {
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .1em; font-weight: 500;
  text-align: left; padding: 0 16px 8px;
}
.container-table tbody tr { background: var(--surface); transition: background .12s; }
.container-table tbody tr:hover { background: var(--surface2); }
.container-table td {
  padding: 14px 16px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.container-table td:first-child { border-left: 1px solid var(--border); border-radius: 6px 0 0 6px; }
.container-table td:last-child  { border-right: 1px solid var(--border); border-radius: 0 6px 6px 0; }

.cell-name  { font-family: var(--mono); font-size: 13px; font-weight: 600; color: #e6edf3; }
.cell-image { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 2px; }

.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
}
.dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.running .dot { background: var(--green); box-shadow: 0 0 7px var(--green); }
.running { color: var(--green); }
.stopped .dot { background: var(--muted); }
.stopped { color: var(--muted); }
.exited  .dot { background: var(--red); }
.exited  { color: var(--red); }
.paused  .dot { background: var(--yellow); }
.paused  { color: var(--yellow); }
.created .dot { background: var(--accent); }
.created { color: var(--accent); }
.cell-uptime { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 3px; }

.cell-stat       { font-family: var(--mono); font-size: 12px; color: var(--text); }
.cell-stat-detail{ font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 2px; }
.cell-stat-idle  { font-family: var(--mono); font-size: 11px; color: var(--muted); }

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

#empty { text-align: center; padding: 60px 0; color: var(--muted); font-family: var(--mono); font-size: 12px; display: none; }

#toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--surface); border: 1px solid var(--border-lit); border-radius: 6px;
  padding: 10px 16px; font-family: var(--mono); font-size: 11px; max-width: 380px;
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s;
  pointer-events: none; z-index: 100;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.ok   { border-color: var(--green); color: var(--green); }
#toast.fail { border-color: var(--red);   color: var(--red); }

#pull-modal {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.75); z-index: 50;
  align-items: center; justify-content: center;
}
#pull-modal.open { display: flex; }
.modal-box { background: var(--surface); border: 1px solid var(--border-lit); border-radius: 8px; padding: 24px 28px; width: 500px; max-width: 92vw; outline: none; }
.modal-title { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--yellow); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; }
.modal-image { font-family: var(--mono); font-size: 12px; color: var(--text); margin-bottom: 14px; }
#pull-log {
  background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
  padding: 12px; font-family: var(--mono); font-size: 11px; color: var(--text);
  height: 160px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; margin-bottom: 16px;
}
.modal-actions { display: flex; justify-content: flex-end; }

.spin { animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Focus outlines for all interactive elements */
a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  .spin { animation: none; }
  button, #toast, .container-table tbody tr { transition: none; }
}

/* ── Login page ───────────────────────────────────────────────────────────── */
.login-page { display: flex; align-items: center; justify-content: center; }
.login-wrapper { width: 100%; max-width: 360px; padding: 24px; }
.login-card {
  background: var(--surface); border: 1px solid var(--border-lit); border-radius: 8px;
  padding: 32px 28px;
}
.login-card .logo { text-align: center; margin-bottom: 28px; }
.login-card label {
  display: block; font-family: var(--mono); font-size: 10px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 6px;
}
.login-card input[type="password"] {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  font-family: var(--mono); font-size: 13px; padding: 10px 12px;
  border-radius: 4px; margin-bottom: 20px;
}
.login-card input[type="password"]:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
.btn-login {
  width: 100%; padding: 10px; background: var(--accent); color: var(--bg);
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  letter-spacing: .06em; border: none; border-radius: 4px; cursor: pointer;
  transition: opacity .12s;
}
.btn-login:hover { opacity: .85; }
.btn-login:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.login-error {
  background: #2a1515; border: 1px solid #3d1e1e; color: var(--red);
  font-family: var(--mono); font-size: 11px; padding: 8px 12px;
  border-radius: 4px; margin-bottom: 16px; text-align: center;
}

/* Responsive — horizontal scroll for narrow screens */
@media (max-width: 768px) {
  header { padding: 0 16px; gap: 12px; flex-wrap: wrap; height: auto; padding: 12px 16px; }
  main { padding: 16px; }
  #container-list { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .container-table { min-width: 640px; }
  .modal-box { padding: 16px 20px; }
  .login-wrapper { padding: 16px; }
}
