*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: #0f172a; color: #e2e8f0; }
body { min-height: 100vh; }
h1, h2, h3 { margin: 0; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; background: rgba(148,163,184,0.12); padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }
a { color: inherit; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 8px; padding: 9px 16px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.15s; background: transparent; color: inherit; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: #3b82f6; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #2563eb; }
.btn-ghost { background: rgba(148,163,184,0.08); border-color: rgba(148,163,184,0.2); }
.btn-ghost:hover { background: rgba(148,163,184,0.15); }
.btn-danger { background: #7f1d1d; color: #fecaca; border-color: #991b1b; }
.btn-danger:hover { background: #991b1b; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---- Login ---- */
.login-body { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f172a, #1e293b); padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: #1e293b; border: 1px solid #334155; border-radius: 16px; padding: 40px; box-shadow: 0 20px 60px rgba(0,0,0,0.4); }
.brand { text-align: center; margin-bottom: 28px; }
.brand h1 { font-size: 22px; margin-top: 12px; }
.brand .sub { color: #94a3b8; font-size: 13px; margin-top: 4px; }
.brand-mark { display: inline-flex; width: 56px; height: 56px; border-radius: 14px; background: linear-gradient(135deg, #3b82f6, #8b5cf6); align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 16px; letter-spacing: 1px; }
.brand-mark.small { width: 32px; height: 32px; font-size: 11px; border-radius: 8px; }

/* ---- Forms ---- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; }
.form label > span { font-size: 13px; color: #94a3b8; }
.form input, .form textarea {
  background: #0f172a; border: 1px solid #334155; color: #e2e8f0;
  padding: 10px 12px; border-radius: 8px; font: inherit; font-size: 14px;
}
.form input:focus, .form textarea:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.2); }
.row-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.checkbox-row { flex-direction: row !important; align-items: center; gap: 8px; }
.checkbox-row input { margin: 0; width: auto; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; align-items: center; }
.error { background: #450a0a; color: #fca5a5; padding: 10px 12px; border-radius: 8px; font-size: 13px; border: 1px solid #7f1d1d; }

/* ---- Topbar ---- */
.topbar { background: #1e293b; border-bottom: 1px solid #334155; position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; gap: 24px; }
.brand-inline { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab { background: transparent; border: none; color: #94a3b8; padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; }
.tab:hover { color: #e2e8f0; background: rgba(148,163,184,0.08); }
.tab.active { color: #60a5fa; background: rgba(59,130,246,0.12); }
.user-area { display: flex; align-items: center; gap: 12px; }

/* ---- Layout ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.view-head h2 { font-size: 20px; }

/* ---- Projects ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.card { background: #1e293b; border: 1px solid #334155; border-radius: 12px; padding: 20px; }
.card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.card dl { margin: 0; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.card dl > div { display: flex; gap: 10px; }
.card dt { color: #94a3b8; min-width: 60px; }
.card dd { margin: 0; flex: 1; word-break: break-all; }

/* ---- Pills ---- */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.pill-ok { background: rgba(34,197,94,0.15); color: #86efac; }
.pill-err { background: rgba(220,38,38,0.18); color: #fca5a5; }
.pill-run { background: rgba(59,130,246,0.18); color: #93c5fd; animation: pulse 1.2s infinite; }
.pill-pending { background: rgba(234,179,8,0.15); color: #fde68a; }
.pill-muted { background: rgba(148,163,184,0.12); color: #94a3b8; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

/* ---- Deploys list ---- */
.list { display: flex; flex-direction: column; gap: 8px; }
.deploy-row { display: grid; grid-template-columns: 90px 1fr auto; gap: 16px; padding: 14px 18px; background: #1e293b; border: 1px solid #334155; border-radius: 10px; cursor: pointer; text-decoration: none; color: inherit; transition: all 0.15s; }
.deploy-row:hover { border-color: #475569; background: #273449; }
.dr-main { min-width: 0; }
.dr-title { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.dr-msg { font-size: 13px; color: #cbd5e1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-meta { text-align: right; font-size: 12px; }

/* ---- Deploy detail ---- */
.deploy-meta { flex: 1; }
.log-view { background: #020617; border: 1px solid #1e293b; border-radius: 10px; padding: 20px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.55; max-height: 70vh; overflow: auto; white-space: pre-wrap; word-break: break-word; }

/* ---- Modal ---- */
.modal { position: fixed; inset: 0; background: rgba(2,6,23,0.7); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 100; backdrop-filter: blur(4px); }
.modal[hidden] { display: none !important; }
#secret-modal { z-index: 110; }
.modal-card { background: #1e293b; border: 1px solid #334155; border-radius: 14px; padding: 24px; max-width: 580px; width: 100%; max-height: 90vh; overflow: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { font-size: 17px; }

/* ---- Copy inputs (secret modal) ---- */
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.field label > span { font-size: 13px; color: #94a3b8; }
.input-copy { display: flex; gap: 8px; align-items: stretch; }
.input-copy input { flex: 1; min-width: 0; background: #0f172a; border: 1px solid #334155; color: #e2e8f0; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.input-copy input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.2); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.copy-btn { white-space: nowrap; min-width: 78px; transition: all 0.15s; }
.copy-btn.copied { background: #14532d; color: #bbf7d0; border-color: #166534; }

.hint-box { margin-top: 16px; padding: 12px 14px; background: #0f172a; border: 1px solid #334155; border-radius: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.hint-box > div { display: flex; align-items: center; gap: 10px; }
.hint-key { color: #94a3b8; min-width: 110px; font-size: 12px; }

/* ---- Toast ---- */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 12px 18px; border-radius: 10px; font-size: 14px; background: #1e293b; border: 1px solid #334155; box-shadow: 0 10px 30px rgba(0,0,0,0.4); z-index: 200; }
.toast-err { border-color: #7f1d1d; background: #450a0a; color: #fca5a5; }
.toast-ok { border-color: #166534; background: #14532d; color: #bbf7d0; }

/* ---- Misc ---- */
.muted { color: #94a3b8; }
.small { font-size: 12px; }
.empty { padding: 40px; text-align: center; color: #94a3b8; background: #1e293b; border: 1px dashed #334155; border-radius: 12px; }
