@import url("css/theme.css");
@import url("css/public.css");

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    min-height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--seafoam); text-decoration: none; transition: color .2s; }
a:hover { color: var(--seafoam-light); }
::selection { background: var(--seafoam-dark); color: #fff; }

h1, h2, h3, h4 { color: var(--text-primary); font-weight: 600; line-height: 1.25; }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 .75rem; }
h3 { font-size: 1rem;   margin: 1rem 0 .5rem; }

code, pre, .mono { font-family: var(--font-mono); }

/* ---------- App shell ---------- */
.app { display: flex; flex-direction: column; min-height: 100vh; }

.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    position: sticky; top: 0; z-index: 100;
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: .75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}
.brand { display: flex; align-items: center; gap: .75rem; }
.brand-mark {
    width: 44px; height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--seafoam), var(--purple));
    display: grid; place-items: center;
    color: #0f172a; font-weight: 800;
}
.brand-name {
    font-size: 1.25rem; font-weight: 700; line-height: 1.2;
    background: linear-gradient(135deg, var(--seafoam), var(--purple-light));
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.brand-sub { color: var(--text-muted); font-size: .75rem; }

.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a {
    color: var(--text-secondary);
    font-size: .875rem; font-weight: 500;
    transition: color .2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--seafoam); }
.nav-user { color: var(--text-muted); font-size: .8125rem; margin-right: .75rem; }

.main {
    flex: 1; width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.75rem 1.5rem 3rem;
}

.footer {
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    padding: 1.25rem 1.5rem;
    margin-top: auto;
}
.footer-inner {
    max-width: 1200px; margin: 0 auto;
    text-align: center; color: var(--text-muted); font-size: .8125rem;
}

/* ---------- Cards & KPIs ---------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
}

.kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.kpi {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
}
.kpi-num { font-size: 2rem; font-weight: 800; color: var(--seafoam); line-height: 1.1; }
.kpi-label {
    margin-top: .25rem;
    color: var(--text-muted);
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 600;
}

/* ---------- Forms ---------- */
.form-row { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .85rem; max-width: 520px; }
.form-row label { color: var(--text-secondary); font-size: .8125rem; font-weight: 500; }
input[type=text], input[type=password], input:not([type]), select, textarea, .input {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .625rem .8rem;
    font: inherit;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus, .input:focus {
    border-color: var(--seafoam);
    box-shadow: 0 0 0 3px rgba(45, 212, 168, .15);
}
input::placeholder { color: var(--text-muted); }

button, .btn {
    display: inline-flex; align-items: center; gap: .4rem;
    background: var(--seafoam);
    color: #0f172a;
    border: 1px solid var(--seafoam);
    border-radius: var(--radius);
    padding: .55rem 1.1rem;
    font: inherit; font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
button:hover, .btn:hover { background: var(--seafoam-light); border-color: var(--seafoam-light); }
button:focus-visible, .btn:focus-visible { box-shadow: 0 0 0 3px rgba(45,212,168,.25); }
.btn-ghost {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border);
}
.btn-ghost:hover { background: rgba(45,212,168,.08); border-color: var(--seafoam); color: var(--seafoam); }
.btn-danger { background: transparent; color: var(--pink); border-color: var(--pink); }
.btn-danger:hover { background: var(--pink); color: #fff; border-color: var(--pink); }

button.link {
    background: transparent; border: none; padding: 0;
    color: var(--seafoam); cursor: pointer; font: inherit;
    text-decoration: underline; text-underline-offset: 2px;
}
button.link:hover { color: var(--seafoam-light); background: transparent; }

.status { margin-left: .75rem; color: var(--text-secondary); font-size: .85rem; }

/* ---------- Tables ---------- */
.grid, .pkg-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    font-size: .875rem;
}
.grid thead, .pkg-table thead {
    background: rgba(45, 212, 168, .05);
    border-bottom: 1px solid var(--border);
}
.grid th, .pkg-table th {
    text-align: left;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .05em;
    font-size: .8125rem;
    font-weight: 600;
    padding: .75rem 1rem;
    white-space: nowrap;
}
.grid td, .pkg-table td {
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    padding: .625rem 1rem;
}
.grid tbody tr, .pkg-table tbody tr { transition: background .15s; }
.grid tbody tr:hover, .pkg-table tbody tr:hover { background: rgba(45, 212, 168, .04); }
.grid code, .pkg-table code {
    color: var(--purple-light);
    font-family: var(--font-mono);
    font-size: .8125rem;
}

/* Row status hints */
.row-built  td:first-child { color: var(--seafoam); font-weight: 600; }
.row-pending td:first-child { color: var(--seafoam-light); font-weight: 600; }

/* Pills (optional) */
.pill {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    border: 1px solid transparent;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.pill-built   { color: var(--seafoam);       background: rgba(45,212,168,.12); border-color: rgba(45,212,168,.35); }
.pill-pending { color: var(--purple-light);  background: rgba(124,58,237,.15); border-color: rgba(124,58,237,.35); }
.pill-failed  { color: var(--pink);          background: rgba(236,72,153,.12); border-color: rgba(236,72,153,.35); }

/* ---------- Log viewer ---------- */
pre.log, .log-view {
    background: #0d1117;
    color: #d6ece6;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: .8125rem;
    line-height: 1.5;
    padding: .9rem 1.1rem;
    max-height: 65vh;
    overflow: auto;
    white-space: pre-wrap;
}

/* ---------- Login ---------- */
.login-body {
    min-height: 100vh;
    display: grid; place-items: center;
    background:
        radial-gradient(60% 60% at 30% 20%, rgba(45,212,168,.10), transparent 60%),
        radial-gradient(50% 50% at 80% 80%, rgba(124,58,237,.12), transparent 60%),
        var(--bg-primary);
    padding: 1.5rem;
}
.login-card {
    width: 100%; max-width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    display: flex; flex-direction: column; gap: .85rem;
}
.login-card h1 {
    margin: 0;
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--seafoam), var(--purple-light));
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.login-card .muted { color: var(--text-muted); font-size: .85rem; margin-bottom: .5rem; }
.login-card label {
    display: flex; flex-direction: column; gap: .3rem;
    color: var(--text-secondary); font-size: .8125rem;
}
.login-card .error {
    color: var(--pink);
    background: rgba(236,72,153,.08);
    border: 1px solid rgba(236,72,153,.3);
    padding: .5rem .75rem;
    border-radius: var(--radius);
    font-size: .85rem;
}
.login-card button { margin-top: .35rem; justify-content: center; }

/* ---------- Misc ---------- */
.spacer { flex: 1; }

@media (max-width: 640px) {
    .header-inner { padding: .5rem 1rem; gap: .75rem; }
    .main { padding: 1rem; }
    .grid th, .grid td, .pkg-table th, .pkg-table td { padding: .5rem .625rem; }
    .nav-links { gap: .9rem; }
}
