/* vellkam-git — plain, self-contained stylesheet. No external fonts or CDN assets. */

:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --border: #e2e5ea;
    --text: #1c2128;
    --muted: #6b7280;
    --accent: #2f5bd7;
    --accent-hover: #2449b3;
    --error: #b42318;
    --error-bg: #fef3f2;
    --success: #15803d;
    --success-bg: #f0fdf4;
    --radius: 8px;
}

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1, h2 {
    margin: 0;
    font-weight: 600;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.05rem; }

code {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.85em;
}

.muted { color: var(--muted); font-weight: 400; }

/* ---------- Layout ---------- */

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px;
    flex: 1;
}

.container-narrow {
    max-width: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    align-items: start;
}

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

.page-head {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.page-head p { margin: 4px 0 0; }

/* ---------- Top bar ---------- */

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.brand {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
    text-decoration: none;
}

.brand span { color: var(--accent); }

.nav { flex: 1; display: flex; gap: 16px; }

.nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
}

.nav a:hover { color: var(--text); }

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

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

/* ---------- Cards ---------- */

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

.card-title {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.card-auth { width: 100%; }

.auth-title {
    font-size: 1.35rem;
    text-align: center;
}

.auth-title span { color: var(--accent); }

.auth-subtitle {
    margin: 6px 0 20px;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
}

.auth-secondary {
    margin-top: 12px;
}

/* ---------- Table ---------- */

.table-wrap {
    overflow-x: auto;
}

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

.table th {
    text-align: left;
    font-weight: 600;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0 12px 8px 0;
    white-space: nowrap;
}

.table td {
    padding: 10px 12px 10px 0;
    border-top: 1px solid var(--border);
    vertical-align: top;
}

.repo-name { font-weight: 500; display: block; }

.repo-desc {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
}

.clone-url {
    display: block;
    color: var(--muted);
    white-space: nowrap;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--border);
}

.badge-private { background: #f3f4f6; color: #374151; }
.badge-public { background: var(--success-bg); color: var(--success); }

/* Build statuses. Colour alone never carries the meaning — the badge shows the status word too,
   which is what a colour-blind reader and a screen reader both rely on. */
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-failed  { background: var(--error-bg);   color: var(--error); }
.badge-running { background: #eff6ff;           color: #1d4ed8; }
.badge-pending { background: #f3f4f6;           color: #374151; }
.badge-cancelled { background: #f3f4f6;         color: #6b7280; }

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

/* ---------- Forms ---------- */

.form { display: flex; flex-direction: column; gap: 16px; }

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

.field label {
    font-size: 0.85rem;
    font-weight: 500;
}

.field input[type="text"],
.field input[type="password"] {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
}

.field input:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    border-color: var(--accent);
}

.field input.input-error {
    border-color: var(--error);
}

.field select {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
}

/* Role selector sitting inline inside a table cell. */
.inline-form {
    display: flex;
    align-items: center;
    gap: 6px;
}

.inline-form select {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.82rem;
}

.field-check {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.field-check label { font-weight: 400; }

.error {
    margin: 0;
    color: var(--error);
    font-size: 0.82rem;
}

.hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
}

/* ---------- Buttons ---------- */

.btn {
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 9px 16px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    align-self: flex-start;
}

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

.btn-block { align-self: stretch; width: 100%; }

.btn-ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--muted);
    padding: 6px 12px;
}

.btn-ghost:hover { color: var(--text); border-color: var(--muted); }

/* ---------- Repository browser ---------- */

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

.browse-toolbar label {
    font-size: 0.85rem;
    font-weight: 500;
}

.breadcrumb {
    font-size: 0.9rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

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

.entry-icon {
    margin-right: 6px;
}

/* File view: long lines scroll horizontally rather than wrapping or widening the page. */
.code-block {
    margin: 0;
    padding: 14px 16px;
    background: #f8f9fb;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.45;
    tab-size: 4;
}

.code-block code {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    white-space: pre;
}

/* ---------- One-time token reveal ---------- */

.token-reveal {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
}

.reveal-title {
    font-size: 1rem;
    margin-bottom: 4px;
}

.reveal-note {
    margin: 0 0 12px;
    font-size: 0.85rem;
    color: #92400e;
}

.token-value {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 0.85rem;
    word-break: break-all;
    user-select: all;
}

.btn-danger {
    color: var(--error);
    border-color: #fecdca;
}

.btn-danger:hover {
    color: #fff;
    background: var(--error);
    border-color: var(--error);
}

/* Irreversible action: filled rather than outlined, so it does not look like the other buttons. */
.btn-danger-solid {
    background: var(--error);
    color: #fff;
}

.btn-danger-solid:hover {
    background: #911c11;
}

.btn:disabled {
    opacity: 0.7;
    cursor: default;
}

/* Clone URL with its copy button. */
.clone-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-copy {
    padding: 3px 9px;
    font-size: 0.78rem;
    flex-shrink: 0;
}

/* Delete confirmation. */
.danger-summary {
    border: 1px solid #fecdca;
    background: var(--error-bg);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 20px;
}

.danger-summary p {
    margin: 0;
    font-size: 0.88rem;
}

.danger-name {
    font-weight: 600;
    font-size: 1rem !important;
    margin: 6px 0 8px !important;
    word-break: break-all;
}

/* Buttons under a form, side by side rather than stacked. */
.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---------- Alerts ---------- */

.alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.88rem;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert p { margin: 0; }

.alert-error {
    background: var(--error-bg);
    border-color: #fecdca;
    color: var(--error);
}

.alert-success {
    background: var(--success-bg);
    border-color: #bbf7d0;
    color: var(--success);
}

/* ---------- Footer ---------- */

.footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: 0.8rem;
}

.footer .container { padding: 14px 20px; }

.row-actions {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

/* ---------- Build log ---------- */

/* Foreign output, rendered as text. Wrapped rather than scrolled sideways: a build log line can be
   thousands of characters long, and a horizontal scrollbar hides the interesting end of it. */
.build-log {
    margin: 0;
    padding: 14px 16px;
    background: #1c2128;
    color: #e6edf3;
    border-radius: 6px;
    overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 70vh;
    overflow-y: auto;
}
