:root {
  --bg: #0f1117;
  --panel: #171a23;
  --border: #2a2e3a;
  --text: #e6e8ee;
  --muted: #9aa0ae;
  --accent: #3ecf8e;
  --danger: #e5484d;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }

#login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 320px;
}

.login-card h1 { margin-top: 0; font-size: 20px; }

form label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

form input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  background: #0f1117;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
}

button {
  background: var(--accent);
  color: #04120b;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}

button.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

button.small { padding: 4px 10px; font-size: 12px; }

.error { color: var(--danger); font-size: 13px; min-height: 18px; }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.header-right { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }

main { padding: 24px; max-width: 1000px; margin: 0 auto; }

section { margin-bottom: 40px; }

.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 12px; }
.section-head-right { display: flex; align-items: center; gap: 16px; }

.view-switcher { display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.view-switcher .view-btn {
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 0;
  font-weight: 500;
  padding: 6px 12px;
  font-size: 13px;
}
.view-switcher .view-btn.active { background: var(--panel); color: var(--text); }
.view-switcher .view-btn + .view-btn { border-left: 1px solid var(--border); }

.inline-form { display: flex; gap: 8px; }
.inline-form input { padding: 6px 10px; background: #0f1117; border: 1px solid var(--border); border-radius: 6px; color: var(--text); }

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

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  position: relative;
}

.card h3 { margin: 0 0 4px; font-size: 16px; padding-right: 20px; }
.card a { color: var(--accent); font-size: 13px; text-decoration: none; }
.card .actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }

/* 3-dot menu */
.menu-wrap { position: absolute; top: 12px; right: 12px; }
.menu-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 2px 6px;
  font-size: 16px;
  line-height: 1;
  border-radius: 4px;
}
.menu-btn:hover { background: rgba(255,255,255,0.06); }
.menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #1d212c;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 140px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 10;
  overflow: hidden;
}
.menu-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text);
  border: none;
  border-radius: 0;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 400;
}
.menu-dropdown button:hover { background: rgba(255,255,255,0.06); }
.menu-dropdown button.danger { color: var(--danger); }

/* list view */
.projects-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.projects-table th, .projects-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
.projects-table th { color: var(--muted); font-weight: 500; }
.projects-table td.name { font-weight: 600; }
.projects-table .row-actions { display: flex; gap: 8px; align-items: center; position: relative; }
.projects-table .progress-cell { font-size: 12px; color: var(--muted); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; margin-bottom: 8px; }
.badge.running { background: rgba(62,207,142,0.15); color: var(--accent); }
.badge.stopped { background: rgba(154,160,174,0.15); color: var(--muted); }
.badge.pending { background: rgba(230,190,60,0.15); color: #e6be3c; }

.card-progress { font-size: 12px; color: var(--muted); min-height: 16px; margin: 4px 0; overflow-wrap: anywhere; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; }
.modal-content { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 24px; width: 420px; max-width: 90vw; position: relative; }
.modal-close { position: absolute; top: 12px; right: 12px; background: transparent; color: var(--muted); font-size: 18px; padding: 0 6px; }
dl { font-size: 13px; }
dt { color: var(--muted); margin-top: 10px; }
dd { margin: 2px 0 0; word-break: break-all; font-family: monospace; }

.status-line { font-size: 13px; color: var(--muted); margin-bottom: 12px; white-space: pre-wrap; }
