/* ============================================================
   toolgun :: core design system
   Used by server-rendered pages (installer, login, admin).
   The builder front-end (Vite) layers its own styles on top.
   ============================================================ */

:root {
    --bg:        #0a0c11;
    --bg-grad:   #16203a;
    --panel:     #11151f;
    --panel-2:   #151a26;
    --panel-3:   #1b2130;
    --border:    #222838;
    --border-2:  #2c3344;

    --text:      #e7e9f0;
    --muted:     #9aa3b6;
    --faint:     #6b7385;

    --accent:        #ff7a18;
    --accent-2:      #ff9a4d;
    --accent-soft:   rgba(255,122,24,.12);
    --accent-ring:   rgba(255,122,24,.35);
    --teal:      #2dd4bf;
    --blue:      #5b8cff;

    --ok:        #34d399;
    --ok-soft:   rgba(52,211,153,.12);
    --warn:      #fbbf24;
    --warn-soft: rgba(251,191,36,.12);
    --danger:    #ff5d5d;
    --danger-soft: rgba(255,93,93,.12);

    --radius:    12px;
    --radius-sm: 8px;
    --radius-lg: 18px;

    --shadow:    0 12px 40px rgba(0,0,0,.45);
    --shadow-sm: 0 2px 10px rgba(0,0,0,.30);

    --font: system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
    --mono: ui-monospace,SFMono-Regular,"JetBrains Mono","Fira Code",Consolas,monospace;
}

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

body {
    font-family: var(--font);
    background:
        radial-gradient(1100px 700px at 85% -15%, rgba(22,32,58,.85) 0%, transparent 55%),
        radial-gradient(900px 600px at -10% 110%, rgba(255,122,24,.06) 0%, transparent 50%),
        var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p  { margin: 0 0 1em; }

code, kbd, pre { font-family: var(--mono); font-size: .92em; }
hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .85rem; }
.mono  { font-family: var(--mono); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-0{margin-top:0}.mt-1{margin-top:.5rem}.mt-2{margin-top:1rem}.mt-3{margin-top:1.5rem}.mt-4{margin-top:2rem}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:.5rem}.mb-2{margin-bottom:1rem}.mb-3{margin-bottom:1.5rem}
.flex{display:flex}.flex-col{flex-direction:column}.items-center{align-items:center}
.justify-between{justify-content:space-between}.gap-1{gap:.5rem}.gap-2{gap:1rem}.gap-3{gap:1.5rem}
.grow{flex:1}.wrap{flex-wrap:wrap}

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 750; letter-spacing: -.02em; }
.brand .mark {
    width: 34px; height: 34px; border-radius: 9px;
    background: linear-gradient(135deg, var(--accent) 0%, #ff5e3a 100%);
    display: grid; place-items: center; color: #1a0e05; font-weight: 900;
    box-shadow: 0 6px 18px rgba(255,122,24,.35);
}
.brand .mark svg { width: 20px; height: 20px; }
.brand .name { font-size: 1.15rem; }
.brand .name b { color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .62rem 1.05rem; border-radius: var(--radius-sm);
    font: inherit; font-weight: 600; font-size: .94rem;
    border: 1px solid var(--border-2); background: var(--panel-3); color: var(--text);
    cursor: pointer; transition: .15s ease; user-select: none; line-height: 1;
}
.btn:hover { border-color: var(--faint); text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #ff5e3a 100%);
    border-color: transparent; color: #1a0e05; font-weight: 700;
    box-shadow: 0 8px 22px rgba(255,122,24,.28);
}
.btn-primary:hover { box-shadow: 0 10px 28px rgba(255,122,24,.4); border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--danger-soft); border-color: rgba(255,93,93,.4); color: #ffb4b4; }
.btn-danger:hover { background: rgba(255,93,93,.2); }
.btn-block { width: 100%; }
.btn-lg { padding: .8rem 1.4rem; font-size: 1rem; }
.btn-sm { padding: .4rem .7rem; font-size: .82rem; }

/* ---------- Cards / panels ---------- */
.card {
    background: linear-gradient(180deg, var(--panel-2) 0%, var(--panel) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}
.card-pad-lg { padding: 2rem; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 820px){ .grid-2,.grid-3{ grid-template-columns: 1fr; } }

/* ---------- Forms ---------- */
.field { margin-bottom: 1.15rem; }
.field > label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: .4rem; }
.field .hint { font-size: .8rem; color: var(--faint); margin-top: .35rem; }
.field .err  { font-size: .8rem; color: var(--danger); margin-top: .35rem; }

.input, input[type=text], input[type=email], input[type=password],
input[type=number], input[type=url], select, textarea {
    width: 100%; padding: .68rem .8rem;
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border-2); border-radius: var(--radius-sm);
    font: inherit; font-size: .95rem; transition: .15s ease;
}
textarea { resize: vertical; min-height: 96px; font-family: var(--mono); }
.input:focus, input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring);
}
.input::placeholder, textarea::placeholder { color: var(--faint); }
.input-group { display: flex; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: none; }

/* Toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: .7rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
    width: 44px; height: 24px; border-radius: 999px; background: var(--panel-3);
    border: 1px solid var(--border-2); transition: .18s ease; position: relative; flex: none;
}
.switch .track::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
    border-radius: 50%; background: var(--muted); transition: .18s ease;
}
.switch input:checked + .track { background: var(--accent-soft); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(20px); background: var(--accent); }

/* ---------- Alerts ---------- */
.alert { padding: .85rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border-2);
    background: var(--panel-2); margin-bottom: 1.1rem; font-size: .92rem; display: flex; gap: .6rem; }
.alert-ok     { background: var(--ok-soft); border-color: rgba(52,211,153,.4); color: #b9f3dc; }
.alert-warn   { background: var(--warn-soft); border-color: rgba(251,191,36,.4); color: #fde9b8; }
.alert-danger { background: var(--danger-soft); border-color: rgba(255,93,93,.4); color: #ffc2c2; }
.alert-info   { background: rgba(91,140,255,.1); border-color: rgba(91,140,255,.4); color: #c7d6ff; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .55rem;
    border-radius: 999px; font-size: .74rem; font-weight: 650; border: 1px solid var(--border-2);
    background: var(--panel-3); color: var(--muted); }
.badge-ok{ color:#bff3dc; background:var(--ok-soft); border-color:rgba(52,211,153,.4) }
.badge-warn{ color:#fde9b8; background:var(--warn-soft); border-color:rgba(251,191,36,.4) }
.badge-danger{ color:#ffc2c2; background:var(--danger-soft); border-color:rgba(255,93,93,.4) }
.badge-accent{ color:var(--accent-2); background:var(--accent-soft); border-color:var(--accent) }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .7rem .8rem; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--panel-2); }

/* ---------- Centered (bare) layout ---------- */
.center-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card.wide { max-width: 720px; }
.auth-head { text-align: center; margin-bottom: 1.5rem; }
.auth-head .sub { color: var(--muted); }

/* ---------- App shell (sidebar) ---------- */
.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, var(--panel) 0%, var(--bg) 100%);
    border-right: 1px solid var(--border); padding: 1.2rem 1rem; display: flex; flex-direction: column; }
.sidebar .brand { padding: .3rem .4rem 1.3rem; }
.nav { display: flex; flex-direction: column; gap: .15rem; }
.nav .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--faint);
    padding: 1rem .7rem .35rem; }
.nav-item { display: flex; align-items: center; gap: .65rem; padding: .6rem .7rem; border-radius: var(--radius-sm);
    color: var(--muted); font-weight: 550; font-size: .94rem; transition: .12s; }
.nav-item:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-2); }
.nav-item .ico { width: 18px; height: 18px; opacity: .9; flex: none; }
.sidebar .foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); font-size: .82rem; color: var(--faint); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1rem 1.6rem; border-bottom: 1px solid var(--border); background: rgba(10,12,17,.6); backdrop-filter: blur(8px);
    position: sticky; top: 0; z-index: 10; }
.content { padding: 1.6rem; max-width: 1200px; width: 100%; }
.page-title { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:1.4rem; }
.page-title h1 { margin: 0; }

@media (max-width: 860px){
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { display: none; }
}

/* ---------- Installer steps ---------- */
.steps { display: flex; align-items: center; gap: 0; margin: 0 0 2rem; }
.step { display: flex; align-items: center; gap: .55rem; color: var(--faint); font-size: .85rem; font-weight: 600; }
.step .dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border-2);
    display: grid; place-items: center; font-size: .8rem; background: var(--bg); flex: none; }
.step.active { color: var(--text); }
.step.active .dot { border-color: var(--accent); color: var(--accent); }
.step.done { color: var(--ok); }
.step.done .dot { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.step .bar { width: 38px; height: 2px; background: var(--border-2); margin: 0 .25rem; }
.step.done .bar { background: var(--ok); }

/* ---------- Stat / KPI ---------- */
.kpi { padding: 1.1rem 1.25rem; }
.kpi .v { font-size: 1.7rem; font-weight: 750; letter-spacing: -.02em; }
.kpi .k { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Check list (requirements) ---------- */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .65rem .25rem; border-bottom: 1px solid var(--border); font-size: .92rem; }
.checklist li:last-child { border-bottom: none; }
.checklist .req-name { display:flex; align-items:center; gap:.5rem; }
.checklist .ok  { color: var(--ok); }
.checklist .bad { color: var(--danger); }

/* ---------- Misc ---------- */
.hero-mark { width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--accent) 0%, #ff5e3a 100%);
    display: grid; place-items: center; box-shadow: 0 12px 32px rgba(255,122,24,.4); }
.hero-mark svg { width: 38px; height: 38px; color: #1a0e05; }
.divider-text { display:flex; align-items:center; gap:1rem; color:var(--faint); font-size:.82rem; margin:1.2rem 0; }
.divider-text::before,.divider-text::after{ content:""; height:1px; background:var(--border); flex:1; }
