:root {
    --bg: #0b1220;
    --bg-soft: #111b2d;
    --card: rgba(23, 34, 53, .92);
    --card-strong: #1b2940;
    --line: #2b3b55;
    --text: #edf4ff;
    --muted: #9fb0c8;
    --primary: #ff8a2a;
    --primary-dark: #e56c08;
    --success: #39d98a;
    --danger: #ff6b75;
    --warning: #ffc857;
    --shadow: 0 24px 70px rgba(0, 0, 0, .34);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at 15% 5%, rgba(255, 138, 42, .13), transparent 29rem),
        radial-gradient(circle at 88% 20%, rgba(66, 153, 225, .10), transparent 27rem),
        linear-gradient(145deg, #09101c, #101a2a 62%, #0c1422);
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.page-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    min-height: 76px;
    padding: 14px clamp(18px, 4vw, 54px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,.08);
    background: rgba(9, 16, 28, .74);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 44px; height: 44px; border-radius: 14px;
    display: grid; place-items: center;
    font-weight: 900; letter-spacing: -.04em;
    color: #101520;
    background: linear-gradient(145deg, #ffad62, var(--primary));
    box-shadow: 0 8px 30px rgba(255, 138, 42, .28);
}
.brand strong, .brand span { display: block; }
.brand strong { font-size: 1rem; }
.brand span { margin-top: 2px; color: var(--muted); font-size: .78rem; }

.main-content {
    width: min(1180px, calc(100% - 32px));
    margin: auto;
    padding: clamp(30px, 5vw, 70px) 0;
    flex: 1;
}
.auth-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(330px, .72fr);
    gap: clamp(30px, 6vw, 86px);
    align-items: center;
}
.intro-panel h1, .welcome-row h1 {
    margin: 10px 0 14px;
    font-size: clamp(2.1rem, 5vw, 4.5rem);
    line-height: .98;
    letter-spacing: -.055em;
}
.intro-panel p { max-width: 650px; font-size: 1.05rem; line-height: 1.7; color: var(--muted); }
.eyebrow { color: var(--primary); font-size: .76rem; font-weight: 900; letter-spacing: .18em; }
.feature-list { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; color: #cad7e8; }
.feature-list li::before { content: "✓"; color: var(--success); font-weight: 900; margin-right: 10px; }

.card {
    border: 1px solid var(--line);
    border-radius: 24px;
    background: linear-gradient(160deg, rgba(27, 41, 64, .96), rgba(18, 28, 45, .96));
    box-shadow: var(--shadow);
}
.login-card, .input-card, .result-card { padding: clamp(22px, 4vw, 36px); }
.card-heading { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 28px; }
.card-heading h2 { margin: 0 0 5px; font-size: 1.35rem; }
.card-heading p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.step {
    flex: 0 0 auto; width: 40px; height: 40px; border-radius: 13px;
    display: grid; place-items: center;
    background: rgba(255, 138, 42, .14);
    color: var(--primary); font-weight: 900; font-size: .75rem;
    border: 1px solid rgba(255, 138, 42, .28);
}
.field { display: grid; gap: 8px; margin-bottom: 19px; }
.field > span { font-size: .83rem; font-weight: 800; color: #cbd8e9; }
.field input {
    width: 100%; height: 52px; border-radius: 14px;
    border: 1px solid #344760;
    background: #0f1929;
    color: var(--text);
    padding: 0 15px;
    outline: none;
    transition: .2s border-color, .2s box-shadow, .2s background;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(255, 138, 42, .12); background: #121f32; }
.field small { color: var(--muted); font-size: .76rem; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 86px; }
.password-toggle {
    position: absolute; right: 8px; top: 8px; height: 36px;
    border: 0; border-radius: 10px; padding: 0 11px;
    color: #dce7f5; background: #24344c; cursor: pointer; font-size: .76rem; font-weight: 800;
}
.btn {
    min-height: 46px; border: 0; border-radius: 13px; padding: 0 18px;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 900; cursor: pointer; text-decoration: none;
    transition: transform .15s, background .2s, opacity .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .58; cursor: wait; transform: none; }
.btn-primary { color: #17130f; background: linear-gradient(135deg, #ffad62, var(--primary)); box-shadow: 0 10px 26px rgba(255, 138, 42, .20); }
.btn-primary:hover { background: linear-gradient(135deg, #ffbb7d, #ff952f); }
.btn-secondary { color: #eef5ff; background: #2b3c57; }
.btn-ghost { color: #dae6f6; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.10); }
.btn-full { width: 100%; }

.alert { border-radius: 14px; padding: 13px 16px; margin-bottom: 22px; border: 1px solid; font-weight: 700; }
.alert-error { color: #ffd9dc; background: rgba(255, 107, 117, .11); border-color: rgba(255, 107, 117, .35); }
.alert-success { color: #d9ffec; background: rgba(57, 217, 138, .10); border-color: rgba(57, 217, 138, .34); }

.workspace { display: grid; gap: 30px; }
.welcome-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.welcome-row h1 { font-size: clamp(1.8rem, 4vw, 3.3rem); margin-bottom: 10px; }
.welcome-row p { margin: 0; color: var(--muted); }
.status-pill { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; padding: 9px 13px; border-radius: 999px; color: #c9fce0; background: rgba(57, 217, 138, .10); border: 1px solid rgba(57, 217, 138, .27); font-size: .78rem; font-weight: 850; }
.status-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 12px var(--success); }
.calculator-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: stretch; }
.result-card { display: flex; flex-direction: column; }
.result-block { padding: 18px; border-radius: 17px; background: #0d1726; border: 1px solid #31445d; }
.result-block > span { color: var(--muted); font-size: .76rem; font-weight: 800; }
.result-main code { display: block; margin: 13px 0 18px; color: #ffd2aa; font-size: clamp(.82rem, 1.8vw, 1.02rem); line-height: 1.65; overflow-wrap: anywhere; user-select: all; }
.technical-details { margin-top: 16px; border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.technical-details summary { padding: 14px 16px; cursor: pointer; color: #cbd8e9; font-size: .83rem; font-weight: 850; background: rgba(255,255,255,.025); }
.detail-row { padding: 14px 16px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.detail-row span { color: var(--muted); font-size: .75rem; }
.detail-row code { color: #dce9fa; overflow-wrap: anywhere; }
.empty-result { min-height: 250px; flex: 1; border: 1px dashed #3a4b63; border-radius: 18px; display: grid; place-content: center; justify-items: center; text-align: center; padding: 24px; color: var(--muted); }
.empty-result strong { color: #dfeafa; margin: 12px 0 4px; }
.empty-result p { margin: 0; font-size: .85rem; }
.empty-icon { width: 52px; height: 52px; border-radius: 17px; display: grid; place-items: center; color: var(--primary); font-weight: 950; font-size: 1.4rem; background: rgba(255, 138, 42, .11); border: 1px solid rgba(255, 138, 42, .24); }
footer { padding: 22px; text-align: center; color: #71849c; font-size: .74rem; }

@media (max-width: 860px) {
    .auth-layout, .calculator-grid { grid-template-columns: 1fr; }
    .auth-layout { gap: 28px; }
    .intro-panel { text-align: center; }
    .intro-panel p { margin-inline: auto; }
    .feature-list { display: none; }
    .welcome-row { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
    .topbar { min-height: 66px; padding-inline: 15px; }
    .brand-mark { width: 39px; height: 39px; border-radius: 12px; }
    .main-content { width: min(100% - 20px, 1180px); padding: 24px 0; }
    .intro-panel h1 { font-size: 2.35rem; }
    .login-card, .input-card, .result-card { padding: 20px 16px; border-radius: 19px; }
    .card-heading { margin-bottom: 22px; }
    .logout-form .btn { min-height: 40px; padding-inline: 14px; }
}

.top-actions { display:flex; align-items:center; gap:12px; }
.user-badge { color:var(--muted); font-size:.8rem; font-weight:800; }
.login-hint { display:block; margin-top:14px; text-align:center; color:var(--muted); }
.admin-grid { display:grid; grid-template-columns:minmax(300px,.72fr) minmax(0,1.28fr); gap:24px; }
.admin-card, .history-card { padding:clamp(20px,3vw,30px); }
.admin-form { display:grid; grid-template-columns:1fr 1fr; gap:0 16px; }
.admin-form .btn { grid-column:1/-1; }
.field select { width:100%; height:52px; border-radius:14px; border:1px solid #344760; background:#0f1929; color:var(--text); padding:0 15px; outline:none; }
.table-wrap { overflow:auto; border:1px solid var(--line); border-radius:16px; }
.data-table { width:100%; border-collapse:collapse; min-width:700px; }
.data-table th, .data-table td { padding:13px 14px; border-bottom:1px solid var(--line); text-align:left; vertical-align:middle; }
.data-table th { color:var(--muted); font-size:.72rem; text-transform:uppercase; letter-spacing:.08em; background:rgba(255,255,255,.025); }
.data-table td { font-size:.84rem; }
.row-actions { display:flex; gap:7px; align-items:center; }
.row-actions form { margin:0; }
.btn-small { min-height:34px; border-radius:10px; padding:0 11px; font-size:.73rem; }
.btn-danger { color:#ffe5e8; background:rgba(255,91,105,.17); border:1px solid rgba(255,91,105,.3); }
.mini-status { display:inline-flex; padding:5px 9px; border-radius:999px; font-size:.7rem; font-weight:900; }
.mini-status.on { color:#c9fce0; background:rgba(57,217,138,.11); }
.mini-status.off { color:#ffd7da; background:rgba(255,91,105,.11); }
.self-label { color:var(--muted); font-size:.75rem; }
.history-list { display:grid; gap:14px; }
.history-item { padding:17px; border-radius:17px; border:1px solid var(--line); background:#0d1726; }
.history-head { display:flex; justify-content:space-between; gap:18px; align-items:flex-start; }
.history-head strong { display:block; color:#eef5ff; }
.history-head span, .history-head time { color:var(--muted); font-size:.75rem; }
.history-meta { display:flex; flex-wrap:wrap; gap:16px; margin:12px 0; color:var(--muted); font-size:.77rem; }
.history-serial { display:grid; gap:7px; }
.history-serial span { color:var(--muted); font-size:.72rem; font-weight:800; }
.history-serial code { color:#ffd2aa; overflow-wrap:anywhere; line-height:1.55; }
.empty-history { padding:28px; border:1px dashed #3a4b63; border-radius:16px; text-align:center; color:var(--muted); }
@media (max-width:980px){ .admin-grid{grid-template-columns:1fr;} }
@media (max-width:620px){ .top-actions{gap:7px}.user-badge{display:none}.admin-form{grid-template-columns:1fr}.history-head{flex-direction:column;gap:5px}.row-actions{flex-wrap:wrap} }


.release-name-result {
    margin-bottom: 14px;
    padding: 14px 16px;
    border: 1px solid rgba(249, 115, 22, .32);
    border-radius: 14px;
    background: rgba(249, 115, 22, .08);
}
.release-name-result span,
.history-release-label {
    display: block;
    margin-bottom: 4px;
    color: var(--accent, #f97316);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.release-name-result strong { font-size: 1.05rem; line-height: 1.35; }
.history-head > div { min-width: 0; }
.history-head strong { display: block; overflow-wrap: anywhere; }

/* Status de pagamento no histórico */
.history-item { transition: border-color .2s, box-shadow .2s, background .2s; }
.history-item-paid {
    border-color: rgba(57, 217, 138, .72);
    background: linear-gradient(160deg, rgba(23, 60, 48, .62), rgba(13, 31, 35, .92));
    box-shadow: inset 4px 0 0 rgba(57, 217, 138, .9), 0 0 0 1px rgba(57, 217, 138, .08);
}
.history-status-area { display:flex; align-items:flex-end; flex-direction:column; gap:8px; }
.payment-badge {
    display:inline-flex; align-items:center; gap:6px;
    padding:6px 10px; border-radius:999px;
    color:#c9fce0; background:rgba(57,217,138,.14);
    border:1px solid rgba(57,217,138,.38);
    font-size:.72rem; font-weight:900;
}
.history-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:15px; padding-top:14px; border-top:1px solid var(--line); }
.history-actions form { margin:0; }
.btn-paid { color:#d9ffec; background:rgba(57,217,138,.16); border:1px solid rgba(57,217,138,.38); }
.btn-paid:hover { background:rgba(57,217,138,.24); }
@media (max-width:620px){ .history-status-area{align-items:flex-start;} }
