/* ============================================================
   TNH VIRAL · Painel de Operações
   Design system compartilhado (index / admin / login)
   Paleta "mesa de operações": grafite profundo + ouro (receita),
   verde/vermelho reservados para semântica de lucro/prejuízo.
   Números sempre em mono tabular (JetBrains Mono).
   ============================================================ */

:root {
    /* Superfícies */
    --bg: #0b0e13;
    --surface: #121721;
    --raised: #19202b;
    --hover: #1e2734;
    --border: #26303e;
    --line: #1c2530;

    /* Texto */
    --text: #e9edf4;
    --muted: #93a0b4;
    --faint: #5e6b7e;

    /* Marca / semântica */
    --gold: #e7b75f;
    --gold-soft: rgba(231, 183, 95, 0.14);
    --profit: #3ecf8e;
    --profit-soft: rgba(62, 207, 142, 0.12);
    --loss: #f2716b;
    --loss-soft: rgba(242, 113, 107, 0.12);
    --warn: #f0a63c;
    --tiktok: #4fd8d2;
    --fb: #6c9ef8;

    /* Tipografia */
    --font-display: 'Sora', 'Segoe UI', sans-serif;
    --font-body: 'Inter', 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;

    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);

    /* Compat com nomes antigos usados em estilos inline */
    --primary-color: var(--gold);
    --success-color: var(--profit);
    --danger-color: var(--loss);
    --warning-color: var(--warn);
    --text-color: var(--text);
    --text-muted: var(--muted);
    --card-bg: var(--surface);
    --border-color: var(--border);
}

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

html {
    color-scheme: dark;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    /* Assinatura: régua de ouro no topo, como fita de cotação */
    border-top: 2px solid var(--gold);
    background-image: radial-gradient(1200px 400px at 50% -200px, rgba(231, 183, 95, 0.05), transparent);
    min-height: 100vh;
}

::selection {
    background: var(--gold-soft);
    color: var(--gold);
}

.container {
    max-width: 1440px;
    width: 94%;
    margin: 0 auto;
    padding: 28px 0 64px;
}

/* ------------------------------------------------------------
   Cabeçalho
   ------------------------------------------------------------ */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

h1, h2, h3 {
    font-family: var(--font-display);
    color: var(--text);
    letter-spacing: -0.01em;
}

h1 {
    font-size: 20px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

h1 .brand-sub {
    display: block;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 500;
    color: var(--faint);
    text-transform: none;
    letter-spacing: 0.14em;
    margin-top: 2px;
}

h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

section {
    margin-bottom: 44px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Ticker do dólar */
.dolar-info {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 14px 6px 12px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--muted);
}

.dolar-info::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 0 0 rgba(231, 183, 95, 0.5);
    animation: ticker-pulse 2.4s ease-out infinite;
}

@keyframes ticker-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(231, 183, 95, 0.45); }
    70%  { box-shadow: 0 0 0 8px rgba(231, 183, 95, 0); }
    100% { box-shadow: 0 0 0 0 rgba(231, 183, 95, 0); }
}

.dolar-info i {
    font-style: normal;
    font-family: var(--font-body);
    color: var(--faint);
    font-size: 12px;
}

.dolar-info span {
    color: var(--gold);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Menu do usuário */
.user-menu {
    position: relative;
    display: inline-block;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--raised);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    color: var(--gold);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.user-avatar:hover {
    border-color: var(--gold);
    background: var(--hover);
}

.dropdown-menu {
    position: absolute;
    top: 48px;
    right: 0;
    min-width: 200px;
    background: var(--raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 6px;
    display: none;
    z-index: 200;
}

.dropdown-menu.show {
    display: block;
    animation: drop-in 0.14s ease-out;
}

@keyframes drop-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    transition: background 0.12s;
}

.dropdown-item:hover {
    background: var(--hover);
}

#logout-btn:hover {
    color: var(--loss);
    background: var(--loss-soft);
}

.dropdown-divider {
    height: 1px;
    background: var(--line);
    margin: 6px 4px;
}

/* ------------------------------------------------------------
   Barra de filtros
   ------------------------------------------------------------ */
.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 32px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--faint);
}

input[type="date"],
input[type="text"],
input[type="email"],
input[type="password"],
select {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 9px 12px;
    font-size: 13px;
    font-family: var(--font-body);
    transition: border-color 0.15s, box-shadow 0.15s;
    min-height: 38px;
}

input[type="date"] {
    font-family: var(--font-mono);
    font-size: 12.5px;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-soft);
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
}

select {
    cursor: pointer;
    min-width: 180px;
}

/* Botões */
button {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 9px 18px;
    min-height: 38px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
}

button:active {
    transform: translateY(1px);
}

button:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

#filtrar {
    background: var(--gold);
    color: #14100a;
    font-weight: 700;
}

#filtrar:hover {
    background: #f0c675;
}

.btn-secondary,
#back-to-dashboard {
    background: transparent;
    border-color: var(--border);
    color: var(--muted);
}

.btn-secondary:hover,
#back-to-dashboard:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: var(--gold-soft);
}

.btn-success {
    background: var(--profit);
    color: #06231a;
}

.btn-success:hover {
    background: #57dda0;
}

.btn-danger {
    background: transparent;
    border-color: var(--loss);
    color: var(--loss);
}

.btn-danger:hover {
    background: var(--loss-soft);
}

/* ------------------------------------------------------------
   Seções / cabeçalhos de seção
   ------------------------------------------------------------ */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.section-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.period-info {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--faint);
}

/* Seletor de plataforma (abas) */
.platform-selector {
    display: inline-flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px;
    margin-bottom: 20px;
    gap: 2px;
    flex-wrap: wrap;
}

.platform-option {
    padding: 7px 18px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
}

.platform-option:hover {
    color: var(--text);
}

.platform-option.active {
    background: var(--gold);
    color: #14100a;
    font-weight: 700;
}

/* ------------------------------------------------------------
   Cards de resumo
   ------------------------------------------------------------ */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
}

.summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    transition: border-color 0.15s, transform 0.15s;
}

.summary-card:hover {
    border-color: var(--faint);
    transform: translateY(-2px);
}

.summary-card h3 {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--faint);
    margin-bottom: 8px;
}

.summary-card p {
    font-family: var(--font-mono);
    font-size: 21px;
    font-weight: 600;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    line-height: 1.2;
}

.summary-card.positive {
    border-color: rgba(62, 207, 142, 0.45);
    background: linear-gradient(180deg, var(--profit-soft), var(--surface) 60%);
}

.summary-card.negative {
    border-color: rgba(242, 113, 107, 0.45);
    background: linear-gradient(180deg, var(--loss-soft), var(--surface) 60%);
}

.positive-value { color: var(--profit) !important; }
.negative-value { color: var(--loss) !important; }

/* ------------------------------------------------------------
   Grupos por data ("linhas de razão")
   ------------------------------------------------------------ */
.date-group {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
}

.date-header {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--gold);
    background: var(--raised);
    border-bottom: 1px solid var(--line);
    border-left: 3px solid var(--gold);
}

.date-content {
    padding: 0;
}

/* ------------------------------------------------------------
   Tabelas
   ------------------------------------------------------------ */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    background: var(--surface);
    color: var(--faint);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    text-align: left;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    user-select: none;
}

tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr {
    transition: background 0.12s;
}

tbody tr:hover {
    background: var(--hover);
}

/* Números da tabela em mono */
td.text-right,
td.text-center {
    font-family: var(--font-mono);
    font-size: 12.5px;
}

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

th.text-center { text-align: center; }
th.text-right { text-align: right; }

/* Ordenação */
th.sortable {
    cursor: pointer;
    transition: color 0.12s;
}

th.sortable:hover {
    color: var(--gold);
}

th.sortable::after {
    content: '↕';
    margin-left: 6px;
    opacity: 0.35;
    font-size: 10px;
}

th.sortable.asc::after {
    content: '↑';
    color: var(--gold);
    opacity: 1;
}

th.sortable.desc::after {
    content: '↓';
    color: var(--gold);
    opacity: 1;
}

/* Badges de plataforma */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}

.badge-tiktok {
    color: var(--tiktok);
    background: rgba(79, 216, 210, 0.1);
    border-color: rgba(79, 216, 210, 0.35);
}

.badge-warning,
.badge-tiktok-internacional {
    color: var(--warn);
    background: rgba(240, 166, 60, 0.1);
    border-color: rgba(240, 166, 60, 0.35);
}

.badge-facebook {
    color: var(--fb);
    background: rgba(108, 158, 248, 0.1);
    border-color: rgba(108, 158, 248, 0.35);
}

.badge-success {
    color: var(--profit);
    background: var(--profit-soft);
    border-color: rgba(62, 207, 142, 0.35);
}

.badge-danger {
    color: var(--loss);
    background: var(--loss-soft);
    border-color: rgba(242, 113, 107, 0.35);
}

.info-badge {
    display: inline-block;
    font-size: 11px;
    color: var(--faint);
    margin-left: 6px;
}

.emoji-roas {
    margin-left: 4px;
}

/* ------------------------------------------------------------
   Busca
   ------------------------------------------------------------ */
.search-box {
    position: relative;
    min-width: 240px;
}

.search-box input {
    width: 100%;
    padding-right: 34px;
}

.clear-search {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--faint);
    cursor: pointer;
    font-size: 12px;
    display: none;
    transition: color 0.12s;
}

.clear-search:hover {
    color: var(--loss);
}

/* ------------------------------------------------------------
   Estados: erro / carregando
   ------------------------------------------------------------ */
.error {
    background: var(--loss-soft);
    border: 1px solid rgba(242, 113, 107, 0.4);
    color: var(--loss);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin: 12px 0;
    font-size: 13px;
}

.loader {
    width: 34px;
    height: 34px;
    margin: 36px auto;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------
   Admin: abas, cards, tabela de usuários
   ------------------------------------------------------------ */
.tab-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.tabs {
    display: flex;
    background: var(--raised);
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: 14px 22px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    user-select: none;
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

.tab-content {
    padding: 22px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.card {
    background: transparent;
}

.card-header {
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.card-body {
    max-width: 100%;
}

#create-user-tab .card-body {
    max-width: 440px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--faint);
}

.form-group input,
.form-group select {
    width: 100%;
}

/* Botões de ação na tabela de usuários */
.actions {
    display: flex;
    gap: 8px;
}

.actions button,
.edit-user-btn,
.domain-permissions-btn,
.delete-user-btn,
.activate-user-btn {
    padding: 5px 12px;
    min-height: 30px;
    font-size: 12px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: var(--radius-sm);
}

.edit-user-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: var(--gold-soft);
}

.domain-permissions-btn:hover {
    border-color: var(--fb);
    color: var(--fb);
    background: rgba(108, 158, 248, 0.1);
}

.delete-user-btn:hover {
    border-color: var(--loss);
    color: var(--loss);
    background: var(--loss-soft);
}

.activate-user-btn:hover {
    border-color: var(--profit);
    color: var(--profit);
    background: var(--profit-soft);
}

/* Notificações */
#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 360px;
}

#notification-container .success,
#notification-container .error {
    margin: 0;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    box-shadow: var(--shadow);
    animation: drop-in 0.18s ease-out;
}

#notification-container .success {
    background: #10241c;
    border: 1px solid rgba(62, 207, 142, 0.5);
    color: var(--profit);
}

#notification-container .error {
    background: #291516;
    border: 1px solid rgba(242, 113, 107, 0.5);
    color: var(--loss);
}

/* Modais */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(6, 8, 12, 0.72);
    backdrop-filter: blur(3px);
    z-index: 400;
    overflow-y: auto;
}

.modal-content {
    position: relative;
    background: var(--raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 480px;
    width: 92%;
    margin: 8vh auto;
    padding: 26px;
    animation: drop-in 0.16s ease-out;
}

.modal-content h2 {
    margin-bottom: 18px;
}

.close-modal {
    position: absolute;
    top: 14px;
    right: 18px;
    font-size: 22px;
    line-height: 1;
    color: var(--faint);
    cursor: pointer;
    transition: color 0.12s;
}

.close-modal:hover {
    color: var(--loss);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

/* Permissões de domínio */
.domain-permissions {
    margin-top: 8px;
}

#domain-user-name {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 12px;
}

.domain-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}

.domain-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--font-mono);
}

.domain-item:hover {
    background: var(--hover);
}

/* Toggle switch */
.switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 21px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.18s;
}

.slider::before {
    content: '';
    position: absolute;
    height: 15px;
    width: 15px;
    left: 3px;
    top: 3px;
    background: var(--text);
    border-radius: 50%;
    transition: transform 0.18s;
}

.switch input:checked + .slider {
    background: var(--profit);
}

.switch input:checked + .slider::before {
    transform: translateX(17px);
}

/* ------------------------------------------------------------
   Login
   ------------------------------------------------------------ */
body.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
    padding: 40px 34px 28px;
    margin: 20px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: var(--gold);
    margin-bottom: 4px;
}

.login-header p {
    color: var(--faint);
    font-size: 13px;
}

.login-form .form-group {
    margin-bottom: 18px;
}

.login-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--faint);
}

.login-form input {
    width: 100%;
    padding: 11px 14px;
    font-size: 14px;
}

.login-form button {
    width: 100%;
    margin-top: 6px;
    padding: 12px;
    background: var(--gold);
    color: #14100a;
    font-weight: 700;
    font-size: 14px;
}

.login-form button:hover {
    background: #f0c675;
}

.error-message,
.success-message {
    display: none;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 18px;
}

.error-message {
    background: var(--loss-soft);
    border: 1px solid rgba(242, 113, 107, 0.4);
    color: var(--loss);
}

.success-message {
    background: var(--profit-soft);
    border: 1px solid rgba(62, 207, 142, 0.4);
    color: var(--profit);
}

.login-footer {
    text-align: center;
    margin-top: 26px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.login-footer p {
    color: var(--faint);
    font-size: 11px;
    letter-spacing: 0.1em;
}

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

@media (max-width: 900px) {
    .container {
        width: 100%;
        padding: 20px 14px 48px;
    }

    header {
        flex-wrap: wrap;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group,
    .filter-group select,
    .search-box {
        width: 100%;
        min-width: 0;
    }

    .filters button {
        width: 100%;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .summary-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .summary-card p {
        font-size: 18px;
    }

    .platform-selector {
        width: 100%;
        justify-content: center;
    }

    .actions {
        flex-wrap: wrap;
    }
}

/* ============================================================
   COCKPIT NOTURNO — hierarquia de instrumentos
   ------------------------------------------------------------
   Num cockpit os mostradores nao tem todos o mesmo tamanho: o
   primario e grande e central, os secundarios ficam numa faixa
   menor, e a luz e' baixa e difusa em vez de contorno duro.
   Aqui: 3 instrumentos primarios (lucro, ROAS, receita) e uma
   faixa de leituras de apoio.
   ============================================================ */

:root {
    --lit-gold:  rgba(231, 183, 95, 0.10);
    --lit-go:    rgba(62, 207, 142, 0.13);
    --lit-stop:  rgba(242, 113, 107, 0.13);
    --read:      #f3f7fc;
    --glass:     #10151d;
}

/* o container deixa de ser grid; as faixas cuidam do layout */
#summary-container.summary-grid {
    display: block;
}

/* ------------------------------------------------ faixa primaria */
.cockpit-primary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.gauge {
    position: relative;
    overflow: hidden;
    background: var(--glass);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px 22px 22px;
    min-height: 148px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* a "luz" do instrumento: brilho difuso vindo de cima, sem contorno duro */
.gauge::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(130% 92% at 50% -10%,
                var(--lit-gold) 0%, transparent 68%);
    pointer-events: none;
}

/* fita de status no topo — o annunciator */
.gauge::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--gold);
    opacity: 0.55;
}

.gauge.is-positive::before { background: radial-gradient(130% 92% at 50% -10%, var(--lit-go) 0%, transparent 68%); }
.gauge.is-positive::after  { background: var(--profit); opacity: 0.8; }
.gauge.is-negative::before { background: radial-gradient(130% 92% at 50% -10%, var(--lit-stop) 0%, transparent 68%); }
.gauge.is-negative::after  { background: var(--loss); opacity: 0.8; }

.gauge h3 {
    position: relative;
    font-family: var(--font-body);
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--muted);
    margin: 0 0 10px;
}

.gauge-read {
    position: relative;
    font-family: var(--font-mono);
    font-size: clamp(2rem, 4.4vw, 2.9rem);
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.035em;
    font-variant-numeric: tabular-nums;
    color: var(--read);
    margin: 0;
}

.gauge-read.is-positive { color: var(--profit); }
.gauge-read.is-negative { color: var(--loss); }

.gauge-alt {
    position: relative;
    font-family: var(--font-mono);
    font-size: 15px;
    font-variant-numeric: tabular-nums;
    color: var(--gold);
    margin: 8px 0 0;
    letter-spacing: -0.01em;
}

.gauge-sub {
    position: relative;
    font-family: var(--font-body);
    font-size: 11.5px;
    color: var(--faint);
    margin-top: 8px;
}

/* --------------------------------- SIGNATURE: gauge de break-even */
/* A pergunta que decide tudo em arbitragem e' "de que lado do 1,00
   eu estou". Isto e' o horizonte artificial dessa pergunta.        */
.breakeven {
    position: relative;
    margin-top: 14px;
}

.breakeven-track {
    position: relative;
    height: 8px;
    border-radius: 4px;
    background: #0a0e14;
    border: 1px solid var(--line);
    overflow: hidden;
}

.breakeven-fill {
    position: absolute;
    top: 0; bottom: 0;
    transition: left 0.4s ease, width 0.4s ease;
}

.breakeven-fill.above {
    background: linear-gradient(90deg, rgba(62,207,142,0.35), var(--profit));
}

.breakeven-fill.below {
    background: linear-gradient(90deg, var(--loss), rgba(242,113,107,0.35));
}

/* o traco do 1,00 — referencia fixa, sempre visivel */
.breakeven-tick {
    position: absolute;
    left: 50%;
    top: -3px; bottom: -3px;
    width: 2px;
    margin-left: -1px;
    background: var(--read);
    opacity: 0.85;
    border-radius: 1px;
}

.breakeven-scale {
    display: flex;
    justify-content: space-between;
    margin-top: 7px;
    font-family: var(--font-body);
    font-size: 9.5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--faint);
}

.breakeven-scale .mid { color: var(--muted); }

/* ------------------------------------------------ faixa secundaria */
.cockpit-secondary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}

.readout {
    background: var(--surface);
    padding: 14px 16px;
}

.readout h4 {
    font-family: var(--font-body);
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--faint);
    margin: 0 0 7px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.readout p {
    font-family: var(--font-mono);
    font-size: 19px;
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    margin: 0;
}

.readout .unit {
    font-size: 12px;
    color: var(--faint);
    margin-right: 2px;
}

@media (max-width: 640px) {
    .gauge { min-height: 128px; padding: 16px 18px 18px; }
    .gauge-read { font-size: 2rem; }
    .cockpit-secondary { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    .breakeven-fill { transition: none; }
}


/* ---------------- cockpit v2: grid alinhado e unidades legiveis ---- */
.cockpit-secondary {
    grid-template-columns: repeat(4, 1fr);
}

.readout h4 {
    font-size: 10px;
    letter-spacing: 0.1em;
}

.readout p {
    font-size: 20px;
}

.readout .unit {
    font-size: 13px;
    color: var(--faint);
    margin-right: 4px;
    font-weight: 400;
}

/* a barra nunca some: mesmo colado no 1,00 fica um fio visivel */
.breakeven-fill { min-width: 3px; border-radius: 2px; }

@media (max-width: 900px) {
    .cockpit-secondary { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
    .cockpit-secondary { grid-template-columns: repeat(2, 1fr); }
}


/* ---------------- cockpit v3: rotulos de duas linhas ---------------- */
.readout h4 {
    white-space: normal;
    line-height: 1.25;
    min-height: 2.5em;
    display: flex;
    align-items: flex-start;
}
