:root {
    --accent: #D6006E;
    --ink: #1c1c22;
    --muted: #6b7280;
    --line: #e5e7eb;
    --bg: #f6f7f9;
    --card: #ffffff;
    --ok: #1a7f44;
    --err: #c0263d;
    --warn: #b45309;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
}
.wrap { max-width: 920px; margin: 0 auto; padding: 0 20px; }

.topbar { background: #111118; color: #fff; }
.topbar .wrap { display: flex; align-items: center; gap: 12px; padding: 14px 20px; }
.topbar .brand { font-weight: 800; letter-spacing: .5px; font-size: 20px; }
.topbar .sub { color: #9ca3af; font-size: 13px; }
.topbar .mode { margin-left: auto; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.mode-dry { background: #3b3b52; color: #c7d2fe; }
.mode-live { background: #7f1d1d; color: #fecaca; }

h1 { font-size: 26px; margin: 28px 0 6px; }
h2 { font-size: 17px; margin: 0 0 10px; }
.lead { color: var(--muted); margin: 0 0 22px; }
.hint { color: var(--muted); font-size: 13px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px; margin-bottom: 22px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
section { padding: 18px 0; border-top: 1px solid var(--line); }
section:first-of-type { border-top: 0; padding-top: 0; }

.field { display: block; margin: 12px 0; }
.field > span { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

input[type=text], input[type=email], input[type=password], select {
    width: 100%; padding: 9px 11px; border: 1px solid #cbd0d8; border-radius: 8px; font-size: 14px; background: #fff;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(214,0,110,.12); }

.subdomain { display: flex; align-items: stretch; }
.subdomain input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.domain-suffix { display: flex; align-items: center; padding: 0 12px; background: #f1f3f5; border: 1px solid #cbd0d8; border-left: 0; border-radius: 0 8px 8px 0; color: var(--muted); white-space: nowrap; }

.accent { display: flex; gap: 8px; align-items: center; }
.accent input[type=color] { width: 46px; height: 40px; padding: 2px; border: 1px solid #cbd0d8; border-radius: 8px; background: #fff; }

.tiers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 760px) { .tiers { grid-template-columns: 1fr 1fr; } }
.tier { position: relative; display: flex; flex-direction: column; gap: 4px; border: 1.5px solid var(--line); border-radius: 10px; padding: 14px; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.tier:hover { border-color: #c7ccd4; }
.tier input { position: absolute; opacity: 0; }
.tier.is-checked { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(214,0,110,.12); }
.tier-label { font-weight: 700; }
.tier-price { font-size: 12px; color: var(--accent); font-weight: 700; }
.tier-desc { font-size: 12px; color: var(--muted); }
.tier-limits { font-size: 11px; color: var(--muted); border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 6px; }

/* --- Nawigacja panelu (Nowa instancja / Instancje) + zalogowane konto --- */
.topbar .nav { display: inline-flex; gap: 6px; margin-left: 18px; vertical-align: middle; }
.topbar .nav a { color: inherit; text-decoration: none; font-weight: 600; font-size: 13px; padding: 4px 10px; border-radius: 7px; opacity: .8; }
.topbar .nav a:hover { opacity: 1; }
.topbar .nav a.is-active { background: rgba(127, 127, 127, .18); opacity: 1; }
.topbar .who { font-size: 12px; color: var(--muted); margin-left: 8px; }

/* --- Lista instancji --- */
table.instances { width: 100%; border-collapse: collapse; font-size: 14px; }
table.instances th, table.instances td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
table.instances th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
table.instances tbody tr:hover { background: rgba(127, 127, 127, .05); }
table.instances tbody tr:last-child td { border-bottom: 0; }
.btn-small { font-size: 12px; padding: 6px 12px; }

/* --- Edycja instancji --- */
.accent-row { display: flex; gap: 8px; align-items: center; }
.accent-row input[type="color"] { width: 42px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.accent-row input[type="text"] { flex: 1; }
.logo-preview { display: flex; align-items: center; gap: 10px; margin: 6px 0 8px; }
.logo-preview img { max-height: 40px; max-width: 200px; border: 1px solid var(--line); border-radius: 6px; padding: 4px; background: #fff; }
.pw-code { font-family: ui-monospace, Consolas, monospace; font-size: 17px; font-weight: 700; letter-spacing: .04em; padding: 2px 8px; background: rgba(127, 127, 127, .12); border-radius: 6px; }
.cmd-preview, .cmd-out { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: rgba(127, 127, 127, .08); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; margin: 8px 0; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.danger-zone { margin-top: 16px; border: 1px solid #f0c9c9; }
.danger-zone h2 { margin-top: 0; }
.btn-danger { background: #c0392b; }
.btn-danger:hover { background: #a93226; }

/* --- Zamówienia (strona publiczna) — statusy --- */
.st { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #eef1f6; color: #5b6675; }
.st-ok { background: #e5f6ec; color: #177245; }
.st-warn { background: #fdf3e1; color: #b45309; }
.st-err { background: #fdeaea; color: #d04444; }
.ord-info { font-size: 12px; color: var(--muted); max-width: 260px; }
.err-note { display: block; color: #b42318; }

/* Kolumna „Wpłata” — ręczne potwierdzanie przelewów tradycyjnych. */
.ord-pay { white-space: nowrap; }
.ord-pay .hint { display: block; margin-top: 3px; font-size: 11.5px; }
.inline-form { display: inline; margin: 0; }
.linkish { appearance: none; border: 0; background: none; padding: 0; margin-top: 3px;
    color: var(--muted); font: inherit; font-size: 11.5px; text-decoration: underline;
    cursor: pointer; }
.linkish:hover { color: var(--err); }

.actions { display: flex; align-items: center; gap: 14px; padding-top: 18px; }
.btn { appearance: none; border: 0; background: var(--accent); color: #fff; font-weight: 700; font-size: 15px; padding: 11px 20px; border-radius: 9px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { filter: brightness(1.06); }
.btn-ghost { background: #111118; }

.err { color: var(--err); font-size: 12.5px; margin-top: 5px; }
.banner { padding: 12px 16px; border-radius: 10px; margin: 0 0 18px; font-size: 14px; }
.banner-err { background: #fdecee; color: var(--err); border: 1px solid #f5c2c9; }
.banner-ok { background: #e9f7ef; color: var(--ok); border: 1px solid #b7e4c7; }
.banner-dry { background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; }

.summary table { width: 100%; border-collapse: collapse; }
.summary th { text-align: left; width: 190px; vertical-align: top; padding: 7px 12px 7px 0; color: var(--muted); font-weight: 600; }
.summary td { padding: 7px 0; border-bottom: 1px solid var(--line); }
.pass { background: #fff7ed; border: 1px solid #fed7aa; padding: 3px 8px; border-radius: 6px; font-size: 14px; }
.tag { font-size: 11px; background: #ede9fe; color: #6d28d9; padding: 2px 7px; border-radius: 999px; margin-left: 6px; }

.log { font: 12.5px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.log-row { display: grid; grid-template-columns: 64px 64px 1fr; gap: 8px; align-items: start; padding: 3px 0; border-bottom: 1px solid #f1f2f4; }
.log-row .t { color: #9aa1ac; }
.log .msg { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; }
.lvl { font-size: 10px; text-transform: uppercase; font-weight: 700; text-align: center; padding: 2px 0; border-radius: 4px; height: fit-content; }
.b-head { background: #111118; color: #fff; }
.b-step { background: #1e3a8a; color: #dbeafe; }
.b-ok { background: #166534; color: #dcfce7; }
.b-err { background: #991b1b; color: #fee2e2; }
.b-warn { background: #92400e; color: #fef3c7; }
.b-cmd { background: #374151; color: #e5e7eb; }
.b-sql { background: #5b21b6; color: #ede9fe; }
.b-out { background: #e5e7eb; color: #374151; }
.b-info { background: #e5e7eb; color: #4b5563; }
.log-error .msg { color: var(--err); }
.log-success .msg { color: var(--ok); font-weight: 700; }
.log-step .msg { font-weight: 700; }

code { background: #f1f3f5; padding: 1px 6px; border-radius: 5px; font-size: 13px; }

/* Żółte ostrzeżenie (np. niekompletne wydanie na stronie Upgrade). */
.warn-box { background: #fdf6e7; border: 1px solid #f5e3bb; color: #92600a;
    border-radius: 9px; padding: 10px 14px; }

/* ---- Ekran logowania (public/login.php) ----
   Karta wyśrodkowana w oknie. Ciemna główka powtarza pasek panelu (.topbar),
   żeby ekran logowania wyglądał jak część narzędzia, a nie obca strona. */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    /* Delikatna poświata w kolorze akcentu — tło nie jest płaskoszare. */
    background:
        radial-gradient(900px 420px at 50% -10%, rgba(214, 0, 110, .10), transparent 70%),
        var(--bg);
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;                       /* przycina ciemną główkę do zaokrągleń */
    box-shadow: 0 18px 50px rgba(17, 17, 24, .10), 0 2px 6px rgba(17, 17, 24, .04);
}
.login-head {
    background: #111118;
    padding: 18px 30px;
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.login-mark { color: #fff; font-weight: 800; letter-spacing: .5px; font-size: 20px; }
.login-tag  { color: #9ca3af; font-size: 12px; }

.login-body { padding: 26px 30px 30px; }
.login-title { font-size: 21px; margin: 0 0 4px; }
.login-lead { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.login-lead strong { color: var(--ink); font-weight: 600; }

.login-form .field { margin: 0 0 14px; }
.login-form input { padding: 11px 12px; font-size: 15px; }
.btn-login { width: 100%; margin-top: 8px; padding: 12px 20px; }

.login-foot {
    margin: 16px 4px 0;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
}
.banner-info { background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; }

/* Autofill: Chrome wymusza własne żółto-niebieskie tło. Nie da się go nadpisać
   przez background, ale box-shadow o dużym spread je zakrywa. */
.login-form input:-webkit-autofill,
.login-form input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 40px #fff inset;
    box-shadow: 0 0 0 40px #fff inset;
    -webkit-text-fill-color: var(--ink);
}
.login-form input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 40px #fff inset, 0 0 0 3px rgba(214, 0, 110, .12);
    box-shadow: 0 0 0 40px #fff inset, 0 0 0 3px rgba(214, 0, 110, .12);
}

@media (max-width: 420px) {
    .login-head { padding: 16px 20px; }
    .login-body { padding: 22px 20px 24px; }
}

/* Wylogowanie w pasku górnym — form, bo GET dałoby się wywołać obcym <img>. */
.topbar .logout { display: inline; margin: 0 0 0 8px; }
.topbar .logout-btn { appearance: none; border: 0; background: none; cursor: pointer;
    color: #9ca3af; font-size: 12px; font-weight: 600; padding: 4px 8px;
    border-radius: 7px; font-family: inherit; }
.topbar .logout-btn:hover { color: #fff; background: rgba(127, 127, 127, .18); }
