/* Minimal stylesheet. System font, neutral palette, density tuned for an admin tool. */

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    font-size: 14px;
    color: #1f2328;
    background: #f6f8fa;
    line-height: 1.5;
}

a       { color: #0969da; text-decoration: none; }
a:hover { text-decoration: underline; }
code    { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: 0.92em; background: #eef1f4; padding: 1px 5px; border-radius: 4px; }

.topbar {
    background: #1f2328;
    color: #fff;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar .brand { color: #fff; font-weight: 600; letter-spacing: 0.02em; }
.topbar nav    { display: flex; gap: 14px; align-items: center; }
.topbar nav a  { color: #c9d1d9; }
.topbar nav .user { color: #8b949e; font-size: 0.92em; }
/* Topbar Log out as a btn-mini — override the link colour from .topbar nav a
 * (which has higher specificity than a bare .btn-mini). */
.topbar nav a.btn-mini {
    color: #1f2328;
    background: #f6f8fa;
    border-color: #d0d7de;
}
.topbar nav a.btn-mini:hover { background: #eaecef; color: #1f2328; }

.container {
    max-width: 960px;
    margin: 24px auto;
    padding: 0 20px;
}

h1 { margin: 0 0 12px; font-size: 1.5em; }

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

.btn-primary {
    background: #1f883d;
    color: #fff;
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 500;
}
.btn-primary:hover { background: #1a7f37; text-decoration: none; }
/* Code inside primary buttons inherits the white text and gets a translucent
 * dark inset, so things like "Edit .env" stay readable. */
.btn-primary code {
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
}

button {
    background: #1f883d;
    color: #fff;
    border: 0;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    font-size: 1em;
}
button:hover { background: #1a7f37; }

.card {
    background: #fff;
    padding: 24px;
    border: 1px solid #d0d7de;
    border-radius: 8px;
}

.login {
    max-width: 360px;
    margin: 60px auto;
}
.login label {
    display: block;
    margin-bottom: 12px;
}
.login label span {
    display: block;
    font-weight: 500;
    margin-bottom: 4px;
}
.login input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 1em;
}
.login input:focus {
    outline: none;
    border-color: #0969da;
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.2);
}
.login button { width: 100%; margin-top: 8px; }

.error {
    color: #cf222e;
    background: #ffebe9;
    border: 1px solid #ff8182;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
}

.empty {
    background: #fff;
    border: 1px dashed #d0d7de;
    padding: 32px;
    border-radius: 8px;
    text-align: center;
    color: #57606a;
}

table.sites {
    width: 100%;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
}
table.sites th, table.sites td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #d0d7de;
}
table.sites tbody tr:last-child td { border-bottom: 0; }
table.sites th { background: #f6f8fa; font-weight: 600; font-size: 0.85em; color: #57606a; text-transform: uppercase; letter-spacing: 0.04em; }

footer { text-align: center; color: #8b949e; padding: 32px 20px; }
footer small { font-size: 0.85em; }

/* Generic helpers */
.muted   { color: #57606a; font-weight: normal; }
.warn    { background: #fff8c5; border: 1px solid #d4a72c; padding: 10px 14px; border-radius: 6px; }
.hint    { display: block; color: #57606a; font-weight: normal; margin: 2px 0 6px; }
.field-error { display: block; color: #cf222e; margin-top: 4px; }

.btn-secondary {
    background: #f6f8fa;
    color: #1f2328;
    border: 1px solid #d0d7de;
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 500;
}
.btn-secondary:hover { background: #eaecef; text-decoration: none; }

.btn-warning {
    background: #d97706;
    color: #fff;
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 500;
}
.btn-warning:hover { background: #b45309; color: #fff; text-decoration: none; }

/* Compact secondary button — for inline row actions and step "Re-do" links
 * where a full .btn-secondary would dominate a table cell or status line. */
.btn-mini {
    display: inline-block;
    background: #f6f8fa;
    color: #1f2328;
    border: 1px solid #d0d7de;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 500;
    line-height: 1.6;
}
.btn-mini:hover { background: #eaecef; text-decoration: none; }

/* GitHub-style tag/pill — used for the per-site current-branch badge in
 * the dashboard sites list. */
.tag {
    display: inline-block;
    background: #ddf4ff;
    color: #0969da;
    border: 1px solid #b6e3ff;
    padding: 1px 8px;
    border-radius: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.82em;
    font-weight: 500;
    line-height: 1.5;
}

/* Right-aligned actions cell in the sites table: tag + Settings button
 * sit on one line with a small gap, regardless of whether the tag exists. */
table.sites td.row-actions {
    text-align: right;
    white-space: nowrap;
}
table.sites td.row-actions .tag { margin-right: 6px; }

.btn-danger {
    background: #cf222e;
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
}
.btn-danger:hover { background: #a40e26; color: #fff; text-decoration: none; }
button.btn-danger { border: 0; cursor: pointer; font-size: 1em; }

.card.danger-zone {
    border: 2px solid #cf222e;
    background: #fff8f8;
}
.card.danger-zone h2 { color: #a40e26; margin-top: 0; }

.card.management {
    border: 2px solid #d97706;
    background: #fef9c3;
}
.card.management h2 { color: #6a3d00; margin-top: 0; }
.card.management form { display: inline-block; }

.callout {
    padding: 10px 14px;
    border-radius: 6px;
    margin: 4px 0 8px;
    background: #ddf4ff;
    border-left: 3px solid #0969da;
    color: #0a3069;
    font-size: 0.9em;
    line-height: 1.5;
}
.callout code {
    background: rgba(255, 255, 255, 0.6);
    color: #0a3069;
}

.card.success {
    border: 2px solid #1f883d;
    background: #f0fdf4;
}
.card.success h2 { color: #1a7f37; margin-top: 0; }

label.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 500;
}
label.checkbox input[type="checkbox"] {
    margin-top: 4px;
}

form.stacked .field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.9em;
    line-height: 1.45;
    box-sizing: border-box;
    resize: vertical;
}
form.stacked .field textarea:focus {
    outline: none;
    border-color: #0969da;
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.2);
}
form.stacked .field input[type="file"] {
    display: block;
    padding: 6px 0;
    font-size: 0.92em;
}

table.kv.compact { font-size: 0.9em; }
table.kv.compact th { width: auto; padding-right: 24px; }
table.kv.compact td { font-family: ui-monospace, SFMono-Regular, monospace; text-align: right; }

details summary { cursor: pointer; padding: 6px 0; font-weight: 500; }

.progress-bar {
    width: 100%;
    height: 14px;
    background: #eaecef;
    border-radius: 7px;
    overflow: hidden;
    border: 1px solid #d0d7de;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1f883d 0%, #2da44e 100%);
    width: 0;
    transition: width 0.2s ease;
}
button:disabled { opacity: 0.6; cursor: not-allowed; }

.spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: -2px;
    margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Stacked form layout (used by /sites/create) */
form.stacked .field {
    display: block;
    margin: 0 0 20px;
}
form.stacked .field label {
    display: block;
    font-weight: 600;
    font-size: 1em;
    margin: 0 0 4px;
    color: #1f2328;
}
form.stacked .field .hint {
    display: block;
    margin: 0 0 8px;
    color: #57606a;
    font-size: 0.88em;
    line-height: 1.5;
}
form.stacked .field input[type="text"],
form.stacked .field input[type="password"] {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 0.95em;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    background: #fff;
    box-sizing: border-box;
}
form.stacked .field input:focus {
    outline: none;
    border-color: #0969da;
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.2);
}
form.stacked .field-feedback {
    margin: 6px 0 0;
    min-height: 1.2em;
    font-size: 0.88em;
}
form.stacked .field-feedback .err    { color: #cf222e; }
form.stacked .field-feedback .ok     { color: #1f883d; }
form.stacked .field-feedback .muted  { color: #57606a; }
form.stacked button { margin-top: 8px; }

/* Per-site flow checklist (site detail) */
ol.flow-steps {
    padding-left: 0;
    list-style: none;
    margin: 0;
}
ol.flow-steps li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-left: 3px solid #d0d7de;
    background: #f6f8fa;
    margin-bottom: 4px;
    border-radius: 0 6px 6px 0;
}
ol.flow-steps li.done {
    border-color: #1f883d;
    background: #f0fdf4;
}
ol.flow-steps .step-name { font-weight: 600; }
ol.flow-steps .step-status { color: #57606a; font-size: 0.92em; }

/* One-time secret reveal panel */
.card.reveal {
    border: 2px solid #d4a72c;
    background: #fff8c5;
    margin-bottom: 24px;
}
.card.reveal h2 { color: #6a3d00; margin-top: 0; }
.card.reveal h3 { margin: 18px 0 8px; }

table.kv {
    border-collapse: collapse;
    margin: 8px 0 16px;
}
table.kv th {
    text-align: left;
    padding: 4px 12px 4px 0;
    color: #57606a;
    font-weight: 500;
    width: 110px;
}
table.kv td { padding: 4px 0; }

pre.key, pre.cmd {
    background: #1f2328;
    color: #f0f6fc;
    padding: 12px 14px;
    border-radius: 6px;
    overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.85em;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-all;
}
pre.error {
    background: #ffebe9;
    border: 1px solid #ff8182;
    color: #cf222e;
    padding: 10px 14px;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.9em;
    white-space: pre-wrap;
    margin-bottom: 16px;
}

.page-head h1 small.muted {
    font-size: 0.5em;
    font-weight: 400;
    margin-left: 8px;
}
.page-head h1 a {
    color: inherit;
    text-decoration: none;
}
.page-head h1 a:hover {
    text-decoration: underline;
}
.external-icon {
    font-size: 0.75em;
    color: #57606a;
    margin-left: 2px;
    vertical-align: 1px;
}
