/* ============================================================
   WARTK — AREA DO CLIENTE · "BLACKOUT" THEME v4.0
   Mesma linguagem do painel: preto neutro, hairlines, mono-labels
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-body: #070708; --bg-card: #101013; --bg-card-hover: #16161a;
    --bg-input: #0b0b0e;
    --border: rgba(255,255,255,0.07); --border-strong: rgba(255,255,255,0.13);
    --accent: #22c55e; --accent-hover: #4ade80;
    --success: #22c55e; --danger: #ef4444; --warning: #f59e0b;
    --text: #f4f4f5; --text-secondary: #d4d4d8; --text-soft: #a1a1aa; --text-muted: #6b6b74;
    --radius: 12px; --radius-sm: 6px;
    --font: 'Archivo', system-ui, sans-serif;
    --font-display: 'Schibsted Grotesk', 'Archivo', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;
    --shadow: 0 1px 2px rgba(0,0,0,0.5), 0 8px 24px rgba(0,0,0,0.35);
}

html { font-size: 14px; }
body { font-family: var(--font); background: var(--bg-body); color: var(--text); min-height: 100vh; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
.client-layout, .client-main, .client-tabs { max-width: 100%; }

::selection { background: rgba(34,197,94,0.35); color: #fff; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 10px; }

/* Atmosfera: glow no topo + malha tecnica sutil */
body::before {
    content: '';
    position: fixed; inset: 0;
    pointer-events: none; z-index: 0;
    background:
        radial-gradient(800px 400px at 50% -10%, rgba(34,197,94,0.09), transparent 62%),
        linear-gradient(rgba(255,255,255,0.014) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.014) 1px, transparent 1px);
    background-size: auto, 44px 44px, 44px 44px;
}
.client-layout, .login-container { position: relative; z-index: 1; }

/* ---- Login Page ---- */
.login-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent 32%), var(--bg-card);
    border: 1px solid var(--border-strong); border-radius: 16px;
    max-width: 400px; width: 100%; padding: 2.5rem 2rem; text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5), 0 24px 64px rgba(0,0,0,0.5);
    animation: fadeUp 0.4s ease both;
}
.login-logo {
    width: 56px; height: 56px; border-radius: 14px;
    background: linear-gradient(150deg, #4ade80, #14532d);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.5rem; font-weight: 800; color: #fff; margin-bottom: 1.2rem;
    box-shadow: 0 0 0 1px rgba(34,197,94,0.4), 0 8px 28px rgba(34,197,94,0.3);
}
.login-card h1 { font-family: var(--font-display); font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.3rem; }
.login-subtitle { color: var(--text-soft); font-size: 0.85rem; margin-bottom: 1.5rem; }
.login-help { margin-top: 1.5rem; padding-top: 1.2rem; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.75rem; line-height: 1.5; }
.login-help p { margin-bottom: 0.2rem; }

/* ---- Auth Tabs ---- */
.auth-tabs { display: flex; gap: 0.3rem; margin-bottom: 1.5rem; border-radius: var(--radius-sm); padding: 0.3rem; border: 1px solid var(--border); background: var(--bg-input); }
.auth-tab { flex: 1; padding: 0.55rem; border: none; border-radius: 4px; background: transparent; color: var(--text-muted); font-family: var(--font); font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: all 0.18s; }
.auth-tab.active { background: var(--accent); color: #fff; box-shadow: 0 2px 10px rgba(34,197,94,0.3); }
.auth-tab:hover:not(.active) { background: rgba(255,255,255,0.04); color: var(--text); }

/* ---- Auth Forms ---- */
.auth-form { text-align: left; }
.auth-form.hidden { display: none; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.4rem; }
.form-group label i { margin-right: 0.3rem; color: var(--text-muted); }
.form-group input {
    width: 100%; padding: 0.62rem 0.85rem; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--bg-input); color: var(--text);
    font-family: var(--font); font-size: 0.85rem; transition: all 0.18s;
}
.form-group input:hover { border-color: var(--border-strong); }
.form-group input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34,197,94,0.14); }
.form-group small { display: block; font-size: 0.7rem; color: var(--text-muted); margin-top: 0.3rem; }

.btn-submit {
    width: 100%; padding: 0.72rem; border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.12);
    background: linear-gradient(180deg, #22c55e, #16a34a); color: #fff;
    font-family: var(--font); font-weight: 700; font-size: 0.9rem; letter-spacing: 0.01em;
    cursor: pointer; transition: all 0.18s;
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 1px 3px rgba(0,0,0,0.5);
}
.btn-submit:hover { background: linear-gradient(180deg, #4ade80, #22c55e); box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 4px 18px rgba(34,197,94,0.35); transform: translateY(-1px); }

/* ---- Alerts ---- */
.alert { padding: 0.8rem 1rem; border-radius: var(--radius-sm); font-size: 0.82rem; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; text-align: left; border: 1px solid transparent; border-left-width: 3px; }
.alert-success { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.18); border-left-color: var(--success); color: #4ade80; }
.alert-error { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.18); border-left-color: var(--danger); color: #fca5a5; }
.alert-warning { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.18); border-left-color: var(--warning); color: #fcd34d; }

/* ---- Client Tabs ---- */
.client-tabs { display: flex; border-bottom: 1px solid var(--border); background: rgba(16,16,19,0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20; }
.client-tab {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.8rem 0.5rem; font-size: 0.85rem; font-weight: 600; text-decoration: none;
    color: var(--text-muted); border-bottom: 2px solid transparent; transition: all 0.18s;
    min-height: 44px; /* touch target minimo */
}
.client-tab.active { color: #fff; border-bottom-color: var(--accent); background: linear-gradient(180deg, transparent 60%, rgba(34,197,94,0.07)); }
.client-tab.active i { color: var(--accent); }
.client-tab:hover:not(.active) { color: var(--text-soft); background: rgba(255,255,255,0.02); }
.tab-badge { background: var(--accent); color: #fff; font-family: var(--font-mono); font-size: 0.6rem; font-weight: 700; padding: 0.1rem 0.35rem; border-radius: 4px; margin-left: 0.2rem; box-shadow: 0 0 10px rgba(34,197,94,0.35); }

/* ---- Dashboard Layout ---- */
.client-layout { min-height: 100vh; display: flex; flex-direction: column; }
.client-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.8rem 1.5rem; background: var(--bg-card); border-bottom: 1px solid var(--border);
}
.client-brand { display: flex; align-items: center; gap: 0.6rem; }
.brand-logo {
    width: 32px; height: 32px; border-radius: 8px;
    background: linear-gradient(150deg, #4ade80, #14532d);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.8rem; color: #fff;
    box-shadow: 0 0 0 1px rgba(34,197,94,0.4), 0 2px 10px rgba(34,197,94,0.25);
}
.brand-text { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; letter-spacing: -0.015em; }
.client-user { display: flex; align-items: center; gap: 0.6rem; }
.user-name { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
.btn-logout { color: var(--text-muted); font-size: 0.9rem; text-decoration: none; padding: 0.3rem; transition: color 0.18s; }
.btn-logout:hover { color: var(--danger); }

.client-main { flex: 1; max-width: 900px; width: 100%; margin: 0 auto; padding: 1.75rem 1rem; }
.client-footer { text-align: center; padding: 1.5rem; color: var(--text-muted); font-size: 0.72rem; font-family: var(--font-mono); letter-spacing: 0.04em; border-top: 1px solid var(--border); }

/* ---- Stats Row ---- */
.stats-row { display: flex; gap: 0.9rem; margin-bottom: 1.75rem; flex-wrap: wrap; }
.stat-mini {
    flex: 1; min-width: 120px; display: flex; align-items: center; gap: 0.8rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.022), transparent 42%), var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem;
    transition: border-color .18s, transform .18s, box-shadow .18s;
}
.stat-mini:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-mini > i { font-size: 1.2rem; color: var(--accent); width: 38px; height: 38px; border-radius: 8px; background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.18); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-num { font-family: var(--font-display); font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; display: block; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-lbl { font-family: var(--font-mono); font-size: 0.62rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); }

/* ---- Section Title ---- */
.section-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.section-title i { color: var(--accent); font-size: 0.95rem; }

/* ---- Empty State ---- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 2.5rem; margin-bottom: 1rem; display: block; opacity: 0.4; }
.empty-state p { margin-bottom: 0.3rem; }

/* ---- Keys Grid ---- */
.keys-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.key-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.022), transparent 38%), var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.2rem; transition: border-color .18s, transform .18s, box-shadow .18s;
    animation: fadeUp 0.4s ease both;
}
.key-card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.key-active { border-left: 3px solid var(--success); }
.key-expiring { border-left: 3px solid var(--warning); }
.key-expired { border-left: 3px solid var(--danger); opacity: 0.65; }

.key-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.8rem; }
.key-game { font-family: var(--font-display); font-weight: 700; font-size: 0.88rem; letter-spacing: -0.01em; display: flex; align-items: center; gap: 0.4rem; }
.key-game i { color: var(--accent); }

.key-status { font-family: var(--font-mono); font-size: 0.62rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.2rem 0.55rem; border-radius: 5px; border: 1px solid transparent; }
.status-active { background: rgba(34,197,94,0.1); color: var(--success); border-color: rgba(34,197,94,0.22); }
.status-expiring { background: rgba(245,158,11,0.1); color: var(--warning); border-color: rgba(245,158,11,0.22); }
.status-expired { background: rgba(239,68,68,0.1); color: var(--danger); border-color: rgba(239,68,68,0.22); }

.key-string {
    background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 0.55rem 0.75rem; font-family: var(--font-mono); font-size: 0.72rem;
    display: flex; justify-content: space-between; align-items: center; cursor: pointer;
    margin-bottom: 0.8rem; transition: all 0.18s;
}
.key-string:hover { border-color: var(--accent); background: rgba(34,197,94,0.05); }
.key-string i { color: var(--text-muted); font-size: 0.8rem; }

.key-details { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; margin-bottom: 0.8rem; }
.detail-label { display: block; font-family: var(--font-mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }
.detail-value { font-size: 0.85rem; font-weight: 600; }

.key-actions { border-top: 1px solid var(--border); padding-top: 0.8rem; }
.inline-form { display: inline; }

.btn-reset {
    display: inline-flex; align-items: center; gap: 0.4rem; width: 100%; justify-content: center;
    padding: 0.55rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
    background: transparent; color: var(--text-secondary); font-family: var(--font); font-weight: 600; font-size: 0.8rem;
    cursor: pointer; transition: all 0.18s; min-height: 38px;
}
.btn-reset:hover:not(.disabled) { border-color: var(--warning); color: var(--warning); background: rgba(245,158,11,0.06); }
.btn-reset.disabled { opacity: 0.4; cursor: not-allowed; }
.reset-count { margin-left: auto; font-family: var(--font-mono); font-size: 0.65rem; color: var(--text-muted); }

/* ---- History Table ---- */
.history-table { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.history-table table { width: 100%; border-collapse: collapse; }
.history-table th { background: rgba(255,255,255,0.02); text-align: left; padding: 0.65rem 0.8rem; font-family: var(--font-mono); font-size: 0.62rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; border-bottom: 1px solid var(--border-strong); }
.history-table td { padding: 0.55rem 0.8rem; font-size: 0.8rem; border-top: 1px solid var(--border); }
.history-table tbody tr { transition: background 0.1s; }
.history-table tbody tr:hover { background: rgba(34,197,94,0.035); }
.history-table code { font-family: var(--font-mono); font-size: 0.75rem; color: #4ade80; }

/* ---- Account Info ---- */
.account-card { background: linear-gradient(180deg, rgba(255,255,255,0.022), transparent 30%), var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem; transition: border-color 0.18s; }
.account-card:hover { border-color: var(--border-strong); }
.account-card-header { padding: 0.85rem 1.2rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 0.5rem; }
.account-card-header i { color: var(--accent); }
.account-card-header h3 { font-family: var(--font-display); font-size: 0.95rem; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.account-row { display: flex; justify-content: space-between; align-items: center; padding: 0.7rem 1.2rem; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.account-row:last-child { border-bottom: none; }
.account-row .row-label { color: var(--text-muted); display: flex; align-items: center; gap: 0.4rem; }
.account-row .row-label i { font-size: 0.75rem; }
.account-row .row-value { font-weight: 600; color: var(--text); }
.account-warning { background: rgba(245,158,11,0.06); border: 1px solid rgba(245,158,11,0.15); border-left: 3px solid var(--warning); border-radius: var(--radius-sm); padding: 1rem 1.2rem; font-size: 0.82rem; color: #fbbf24; line-height: 1.6; margin-bottom: 1rem; }
.account-warning strong { color: #fcd34d; }

.text-muted { color: var(--text-muted); }
.text-warning { color: var(--warning); }

/* ---- Animacoes ---- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.keys-grid .key-card:nth-child(2) { animation-delay: 0.04s; }
.keys-grid .key-card:nth-child(3) { animation-delay: 0.08s; }
.keys-grid .key-card:nth-child(4) { animation-delay: 0.12s; }
.keys-grid .key-card:nth-child(5) { animation-delay: 0.16s; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Foco acessivel */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---- Status dot (online/offline de device) ---- */
.status-dot { display:inline-block; width:8px; height:8px; border-radius:50%; vertical-align:middle; flex-shrink:0; }
.status-dot--on   { background:#22c55e; box-shadow:0 0 0 3px rgba(34,197,94,0.16); animation: wkDotPulse 2s ease-in-out infinite; }
.status-dot--off  { background:#ef4444; box-shadow:0 0 0 3px rgba(239,68,68,0.12); }
.status-dot--none { background:#6b6b74; opacity:0.7; }
.status-dot-lbl   { font-size:0.7rem; margin-left:0.3rem; color:var(--text-muted); vertical-align:middle; }
@keyframes wkDotPulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ---- Atividade GitHub (aba Noticias) ---- */
.gh-activity-wrap { display: grid; grid-template-columns: 1.5fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
@media (max-width: 760px) { .gh-activity-wrap { grid-template-columns: 1fr; } }
/* min-width:0 deixa o card encolher abaixo da largura do heatmap */
.gh-card { background: linear-gradient(180deg, rgba(255,255,255,0.022), transparent 38%), var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; min-width: 0; max-width: 100%; overflow: hidden; transition: border-color 0.18s; }
.gh-card:hover { border-color: var(--border-strong); }
.gh-card-head { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-display); font-size: 0.88rem; font-weight: 700; color: var(--text); margin-bottom: 0.9rem; }
.gh-card-head i { color: var(--accent); }
.gh-total { margin-left: auto; font-family: var(--font-mono); font-size: 0.64rem; color: var(--text-muted); font-weight: 500; }
.gh-scroll { overflow-x: auto; padding-bottom: 0.3rem; }
.gh-scroll::-webkit-scrollbar { height: 6px; }
.gh-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.gh-grid { display: flex; gap: 3px; min-width: max-content; }
.gh-week { display: flex; flex-direction: column; gap: 3px; }
.gh-cell { width: 11px; height: 11px; border-radius: 2px; display: block; }
.gh-cell.gh-empty { background: transparent; }
.gh-l0 { background: rgba(255,255,255,0.05); }
.gh-l1 { background: rgba(34,197,94,0.30); }
.gh-l2 { background: rgba(34,197,94,0.50); }
.gh-l3 { background: rgba(34,197,94,0.75); }
.gh-l4 { background: var(--accent); box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.gh-legend { display: flex; align-items: center; gap: 4px; justify-content: flex-end; font-size: 0.68rem; color: var(--text-muted); margin-top: 0.6rem; }
.gh-legend .gh-cell { width: 10px; height: 10px; }
.gh-commits-list { display: flex; flex-direction: column; max-height: 240px; overflow-y: auto; }
.gh-commit { display: flex; align-items: flex-start; gap: 0.55rem; padding: 0.5rem 0.1rem; border-bottom: 1px solid var(--border); font-size: 0.8rem; }
.gh-commit:last-child { border-bottom: none; }
.gh-commit > i { color: var(--accent); font-size: 0.7rem; margin-top: 0.25rem; }
.gh-commit-text { color: var(--text-secondary); flex: 1; line-height: 1.4; min-width: 0; overflow-wrap: anywhere; }
.gh-commit-date { font-family: var(--font-mono); font-size: 0.62rem; color: var(--text-muted); white-space: nowrap; margin-top: 0.15rem; }
.gh-empty-msg { font-size: 0.78rem; color: var(--text-muted); padding: 1.2rem 0.2rem; text-align: center; }

/* ---- Responsivo ---- */
/* Tabelas (historico de resets) — rolar no lugar de espremer/cortar */
@media (max-width: 600px) {
    .client-main { padding: 1.2rem 0.8rem; }
    .client-header { padding: 0.8rem 1rem; }
    .history-table table { min-width: 560px; }
    .history-table th, .history-table td { white-space: nowrap; }
    .section-title { font-size: 1rem; }
    .gh-activity-wrap { gap: 0.8rem; }
    .gh-card { padding: 0.9rem; }
}

@media (max-width: 480px) {
    .client-tab { font-size: 0.8rem; padding: 0.7rem 0.3rem; flex-direction: column; gap: 0.2rem; }
    .client-tab i { font-size: 1rem; }
    .tab-label { font-size: 0.65rem; }
    .keys-grid { grid-template-columns: 1fr; }
    .stats-row { display: grid; grid-template-columns: 1fr 1fr; }
    .stat-mini { min-width: 0; padding: 0.85rem 0.9rem; }
    .stat-num { font-size: 1.25rem; }
    .client-header { flex-wrap: wrap; gap: 0.5rem; }
    .user-name { font-size: 0.78rem; max-width: 55vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .key-details { grid-template-columns: 1fr; }
    .gh-cell { width: 10px; height: 10px; }
    .gh-card-head { flex-wrap: wrap; }
    .gh-total { margin-left: 0; width: 100%; }
    .gh-commits-list { max-height: 200px; }
}
