@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700;800;900&display=swap');

:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-strong: #eef3f8;
    --text: #17202a;
    --muted: #667085;
    --border: #d8e0ea;
    --primary: #12684f;
    --primary-dark: #0d4d3b;
    --danger: #b42318;
    --shadow: 0 18px 40px rgba(24, 39, 75, 0.12);
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

.offline-banner {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 10px 14px;
    background: #fff4f3;
    color: var(--danger);
    border-bottom: 1px solid rgba(180, 35, 24, 0.26);
    font-weight: 800;
    text-align: center;
}

a {
    color: inherit;
}

.page {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 16px;
}

.auth-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 20px;
}

/* Em celular/POS: formulário no topo para o teclado virtual não cobrir os campos */
@media (max-width: 719px) {
    .auth-page {
        align-items: start;
        padding-top: 32px;
    }
}

.auth-card,
.panel {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.auth-card {
    max-width: 420px;
    padding: 28px;
}

.brand {
    margin: 0 0 6px;
    font-size: 28px;
    line-height: 1.15;
}

.subtitle {
    margin: 0 0 24px;
    color: var(--muted);
}

.field {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.field label {
    font-weight: 700;
}

.field small {
    color: var(--muted);
    font-size: 13px;
}

.field select[multiple] {
    min-height: 168px;
    padding: 8px;
}

.field input,
.field select {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    font: inherit;
    background: #fff;
}

.field input:focus,
.field select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(18, 104, 79, 0.14);
    outline: none;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    border: 0;
    border-radius: 8px;
    padding: 12px 16px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.button.slim {
    width: auto;
    min-height: 42px;
}

.button:hover,
.button:focus {
    background: var(--primary-dark);
}

.button:active {
    transform: scale(0.97);
    opacity: 0.9;
}

.alert {
    margin-bottom: 18px;
    border: 1px solid rgba(180, 35, 24, 0.26);
    border-radius: 8px;
    padding: 12px 14px;
    background: #fff4f3;
    color: var(--danger);
}

.alert.alert-success,
.alert-success {
    border-color: rgba(18, 104, 79, 0.24);
    background: #eefaf5;
    color: #0d4d3b;
}

.alert.alert-info,
.alert-info {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #92400e;
}

.success {
    margin: 18px 0;
    border: 1px solid rgba(18, 104, 79, 0.24);
    border-radius: 8px;
    padding: 12px 14px;
    background: #eefaf5;
    color: var(--primary-dark);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar div {
    display: grid;
    gap: 2px;
}

.topbar span {
    color: var(--muted);
    font-size: 14px;
}

.link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    background: var(--surface-strong);
    font-weight: 700;
    text-decoration: none;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.link-button:active {
    transform: scale(0.97);
    opacity: 0.85;
}

.panel {
    padding: 22px;
}

.panel + .panel {
    margin-top: 18px;
}

.panel h1 {
    margin: 0 0 8px;
    font-size: 26px;
    line-height: 1.2;
}

.panel p {
    margin: 0;
    color: var(--muted);
}

.panel p + p {
    margin-top: 8px;
}

.panel form {
    margin-top: 22px;
}

.test-list {
    margin-top: 24px;
    border-top: 1px solid var(--border);
    padding-top: 18px;
}

.test-list h2 {
    margin: 0 0 10px;
    font-size: 18px;
}

.test-list ul {
    margin: 0;
    padding-left: 20px;
    color: var(--muted);
}

.table-wrap {
    width: 100%;
    margin-top: 14px;
    overflow-x: auto;
}

.sa-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.sa-table {
    width: 100%;
    border-collapse: collapse;
}

.sa-table th,
.sa-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.sa-table thead th {
    background: var(--surface-strong);
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}

.calendar-days {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.calendar-days label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.calendar-days input {
    width: auto;
    min-height: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
    background: #fff;
}

th,
td {
    border-bottom: 1px solid var(--border);
    padding: 10px 8px;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
}

tbody tr:hover {
    background: #f9fbfd;
}

.section-head {
    display: grid;
    gap: 14px;
    margin-bottom: 18px;
}

.section-head h1 {
    margin-bottom: 6px;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 22px;
}

.stat-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin: 16px 0 20px;
}

.stat-card {
    background: #fff;
    border: 1px solid #e2e4e8;
    border-radius: 8px;
    padding: 16px;
}

.stat-card .stat-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 6px;
}

.stat-card .stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.stat-card .stat-value-neg {
    color: #A32D2D;
}
.stat-card .stat-value-pos {
    color: #15803d;
}
.stat-card .stat-desc {
    font-size: 11px;
    color: #6b7280;
    margin-top: 4px;
}

.metric-card {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 132px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px 18px 18px 22px;
    background: #fff;
}

.metric-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: var(--border);
}

.metric-title {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
}

.metric-value {
    color: var(--text);
    font-size: 32px;
    font-weight: 800;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.metric-desc {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.35;
}

.metric-card.accent::before {
    background: #12684f;
}

.metric-card.money::before {
    background: #2563eb;
}

.metric-card.warning::before {
    background: #d97706;
}

.metric-card.success-card::before {
    background: #16803f;
}

.metric-card.danger-card::before {
    background: #b42318;
}

.metric-card.neutral::before {
    background: #475467;
}

.admin-actions {
    display: grid;
    gap: 12px;
    margin-top: 22px;
}

.admin-action {
    display: grid;
    gap: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    background: var(--surface-strong);
    text-decoration: none;
}

.admin-action strong {
    font-size: 18px;
}

.admin-action span {
    color: var(--muted);
}

.filter-grid {
    display: grid;
    gap: 12px;
}

.filter-panel {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    background: #fff;
}

.filter-collapse {
    margin: 0 0 20px;
}

.filter-collapse > summary {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    list-style: none;
    font-weight: 700;
    color: var(--text);
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-strong);
}

.filter-collapse > summary::-webkit-details-marker {
    display: none;
}

.filter-collapse > summary::before {
    content: '▸';
    font-size: 12px;
    color: var(--muted);
}

.filter-collapse[open] > summary::before {
    content: '▾';
}

.filter-collapse-summary {
    font-weight: 400;
    color: var(--muted);
}

.filter-collapse > .filter-panel,
.filter-collapse > form.filter-panel {
    margin-top: 8px;
    border-top-left-radius: 8px;
}

.detail-grid {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.detail-grid p {
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 8px;
    padding: 4px 9px;
    background: var(--surface-strong);
    color: var(--text);
    font-size: 14px;
    font-weight: 800;
}

.status-badge-success {
    background: #dcfce7;
    color: #166534;
}

.status-badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.inline-form {
    margin: 0;
}

.admin-summary-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 18px 0 4px;
}

.admin-summary-strip span {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
    background: var(--surface-strong);
    color: var(--muted);
    font-weight: 700;
}

.table-input {
    width: 100%;
    min-width: 110px;
    min-height: 40px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
}

.schema-list {
    display: grid;
    gap: 10px;
    margin-top: 22px;
}

.schema-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: #fff;
}

.schema-row span {
    color: var(--muted);
}

.schema-row em {
    font-style: normal;
    font-weight: 700;
}

.schema-row .ok {
    color: var(--primary-dark);
}

.schema-row .fail {
    color: var(--danger);
}

.pos-shell {
    display: grid;
    gap: 10px;
}

.pos-hero {
    display: grid;
    gap: 4px;
}

.pos-hero h1 {
    margin: 0;
    font-size: 22px;
    line-height: 1.1;
}

.pos-hero p {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
}

.pos-actions,
.pos-form {
    display: grid;
    gap: 12px;
}

.pos-actions.compact {
    margin-top: 16px;
}

.pos-actions--flex-test {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin: 0 -4px 8px;
}

.pos-actions--flex-test > a,
.pos-actions--flex-test > button {
    box-sizing: border-box;
    flex: 0 0 calc(50% - 8px);
    margin: 0 4px 8px;
    max-width: calc(50% - 8px);
}

.pos-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 18px;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.pos-button:active {
    transform: scale(0.97);
    opacity: 0.88;
}

.pos-button.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.pos-button.danger {
    border-color: rgba(180, 35, 24, 0.26);
    background: #fff4f3;
    color: var(--danger);
}

.pos-list {
    display: grid;
    gap: 10px;
}

.pos-row {
    display: grid;
    gap: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    background: var(--surface);
    text-decoration: none;
}

.pos-row span {
    color: var(--muted);
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pos-metrics {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.pos-metrics div {
    display: grid;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    background: var(--surface);
}

.pos-metrics span {
    color: var(--muted);
    font-weight: 700;
}

.pos-metrics strong {
    font-size: 28px;
}

.pos-metrics small {
    color: var(--muted);
    font-weight: 700;
}

/* Caixa do Dia (Cambista): cards na mesma proporcao dos stat-card do Admin/Dashboard */
.pos-metrics--compact span {
    font-size: 12px;
}

.pos-metrics--compact strong {
    font-size: 20px;
}

.period-filter {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.period-filter a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-weight: 800;
    text-decoration: none;
}

.period-filter a.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.secondary-summary {
    display: grid;
    gap: 4px;
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    background: var(--surface);
}

.secondary-summary span,
.secondary-summary small {
    color: var(--muted);
    font-weight: 700;
}

.secondary-summary strong {
    font-size: 18px;
}

.compact-panel {
    margin-top: 16px;
}

.recent-pules {
    display: grid;
    gap: 8px;
}

.recent-pule-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    align-items: center;
    min-height: 52px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    color: var(--text);
    text-decoration: none;
}

.recent-pule-row span {
    color: var(--muted);
    font-weight: 800;
}

.recent-pule-row em {
    font-style: normal;
}

.empty-state {
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 14px;
    color: var(--muted);
    background: var(--surface);
}

.bet-summary {
    display: grid;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: var(--surface-strong);
}

.bet-summary div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.bet-summary span {
    color: var(--muted);
    font-weight: 700;
}

.bet-summary strong {
    color: var(--text);
    font-size: 18px;
}

.lottery-checks {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.lottery-checks label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    background: var(--surface);
    font-weight: 700;
}

.lottery-checks input {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}

.muted-option {
    color: var(--muted);
    background: var(--surface-strong) !important;
}

.praca-group {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
}

.praca-group summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 54px;
    padding: 14px;
    cursor: pointer;
    list-style: none;
}

.praca-group summary::-webkit-details-marker {
    display: none;
}

.praca-group summary::after {
    content: "+";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
    font-weight: 800;
}

.praca-group[open] summary::after {
    content: "-";
}

.praca-group summary span {
    margin-left: auto;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.praca-group .lottery-checks {
    border-top: 1px solid var(--border);
    padding: 12px;
    margin-top: 0;
}

.quick-values {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.quick-values .link-button {
    min-height: 48px;
    font-size: 18px;
}

.money-machine-input {
    min-height: 58px;
    text-align: right;
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 0;
    background: #fff;
}

.money-keypad {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 16px;
}

.money-keypad .link-button {
    min-height: 44px;
    font-size: 17px;
}

.final-lotteries {
    border-top: 1px solid var(--border);
    padding-top: 14px;
}

.group-entry {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.group-entry-progress {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.group-entry-progress span {
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 10px;
    background: var(--surface-strong);
    color: var(--muted);
    font-weight: 800;
}

.group-entry-progress span.filled {
    border-color: rgba(18, 104, 79, 0.28);
    background: #eefaf5;
    color: var(--primary-dark);
}

.pick-chip {
    min-height: 34px;
    border: 1px solid rgba(18, 104, 79, 0.28);
    border-radius: 8px;
    padding: 7px 10px;
    background: #eefaf5;
    color: var(--primary-dark);
    font: inherit;
    font-weight: 900;
    cursor: pointer;
}

.value-mode,
.current-bet-summary {
    display: grid;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: var(--surface-strong);
}

.value-mode {
    grid-template-columns: 1fr;
}

.value-mode legend {
    font-weight: 800;
}

.value-mode label,
.current-bet-summary div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.value-mode input {
    width: 18px;
    height: 18px;
}

.current-bet-summary span {
    color: var(--muted);
    font-weight: 700;
}

.current-bet-summary strong {
    text-align: right;
}

.pule {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    border: 1px dashed var(--text);
    border-radius: 8px;
    padding: 16px;
    background: #fff;
    color: #111;
    font-family: Arial, Helvetica, sans-serif;
}

.compact-pule {
    max-width: 320px;
    padding: 12px;
}

/* Cabeçalho de marca do comprovante compacto (render_pule_compacta() em
   includes/pule.php — admin/imprimir-pule.php e operador/pule.php) — mesmo
   verde de COR_PRIMARIA_BICHO (config/tema.php). CSS não lê constante PHP,
   então o hex é repetido aqui de propósito, mantendo o mesmo valor. Neutralizado
   em @media print logo abaixo — impressora térmica é monocromática, fundo
   colorido só desperdiça tinta/fica feio no papel. */
.pule-header-brand {
    text-align: center;
    margin-bottom: 8px;
    background: #173404;
    border-radius: 6px;
    padding: 10px 8px 8px;
}
.pule-header-brand h1 {
    color: #fff;
}

.pule h1 {
    margin: 0 0 6px;
    font-size: 20px;
    text-align: center;
}

.compact-pule h1 {
    margin-bottom: 8px;
    font-size: 17px;
    letter-spacing: 0;
}

.compact-pule h2 {
    margin: 0 0 6px;
    font-size: 14px;
    line-height: 1.15;
    letter-spacing: 0;
}

.pule-title {
    text-align: center;
    font-weight: 800;
}

.pule p {
    margin: 4px 0;
}

.compact-pule p {
    margin: 2px 0;
    color: #111;
    font-size: 13px;
    line-height: 1.22;
}

.pule-line {
    border-top: 1px dashed #111;
    margin: 10px 0;
}

.compact-pule .pule-line {
    margin: 7px 0;
}

.pule-block,
.pule-total {
    display: grid;
    gap: 2px;
    margin: 7px 0;
}

.pule-block span,
.pule-total span {
    color: #111;
    font-size: 12px;
    font-weight: 800;
}

.pule-block strong,
.pule-total strong {
    color: #111;
    font-size: 14px;
    line-height: 1.2;
}

.pule-total strong {
    font-size: 18px;
}

.pule-bet {
    margin: 0;
}

.pule-picks {
    display: grid;
    gap: 1px;
    margin-bottom: 6px;
}

.result-entry-grid {
    margin-bottom: 16px;
}

.result-preview {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 18px 0;
}

.result-preview div {
    display: grid;
    gap: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    background: var(--surface-strong);
}

.result-preview span,
.ticket-results span {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.result-preview strong {
    font-size: 26px;
    line-height: 1.1;
}

.result-ticket {
    width: 100%;
    max-width: 340px;
    margin: 0 auto;
    border: 1px dashed #111;
    border-radius: 8px;
    padding: 16px;
    background: #fff;
    color: #111;
    font-family: Arial, Helvetica, sans-serif;
}

.result-ticket h1 {
    margin: 0 0 10px;
    font-size: 22px;
    text-align: center;
}

.result-ticket p {
    margin: 4px 0;
    color: #111;
}

.ticket-results {
    display: grid;
    gap: 6px;
    margin: 14px 0;
}

.ticket-results div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px dashed #bbb;
    padding-bottom: 5px;
}

.ticket-results strong {
    font-size: 20px;
    letter-spacing: 0;
}

.result-ticket-block {
    display: grid;
    gap: 8px;
    margin: 10px 0 14px;
}

.compact-result-head {
    display: grid;
    gap: 2px;
    padding-bottom: 6px;
    border-bottom: 1px solid #d9dee7;
}

.compact-result-head h2 {
    margin: 0;
    font-size: 17px;
    line-height: 1.15;
    letter-spacing: 0;
}

.compact-result-head p {
    margin: 0;
    color: #444;
    font-size: 13px;
}

.compact-result-lines {
    display: grid;
    gap: 3px;
}

.compact-result-lines p {
    display: grid;
    grid-template-columns: 34px 1fr;
    align-items: baseline;
    gap: 6px;
    margin: 0;
    color: #111;
    line-height: 1.25;
}

.compact-result-lines strong {
    font-size: 14px;
    white-space: nowrap;
}

.compact-result-lines span {
    font-size: 14px;
    color: #111;
}

.compact-result-separator {
    height: 1px;
    margin: 4px 0 7px;
    border-top: 1px solid #cfd6df;
}

.table-result-lines {
    min-width: 170px;
}

.ticket-print-time {
    border-top: 1px dashed #111;
    padding-top: 8px;
    font-size: 13px;
    text-align: center;
}

@media print {
    @page {
        size: 80mm auto;
        margin: 3mm;
    }

    body {
        background: #fff;
        font-size: 11px;
    }

    .topbar,
    .pos-actions,
    .print-actions,
    .offline-banner {
        display: none;
    }

    .page {
        max-width: none;
        padding: 0;
    }

    .pule {
        border: 0;
        border-radius: 0;
        box-shadow: none;
        max-width: 74mm;
        padding: 0;
        font-size: 10px;
        line-height: 1.18;
    }

    .pule h1 {
        font-size: 14px;
    }

    .compact-pule p {
        font-size: 10px;
        line-height: 1.15;
    }

    .compact-pule h2 {
        font-size: 11px;
    }

    .pule-block,
    .pule-total {
        margin: 5px 0;
    }

    .result-ticket {
        border: 0;
        max-width: 280px;
        padding: 0;
    }

    .result-ticket-block {
        gap: 5px;
        margin: 7px 0 10px;
    }

    .compact-result-head h2 {
        font-size: 13px;
    }

    .compact-result-head p,
    .compact-result-lines strong,
    .compact-result-lines span {
        font-size: 11px;
    }

    .compact-result-lines {
        gap: 2px;
    }

    .compact-result-separator {
        height: 0;
        margin: 6px 0;
        border-top: 1px dashed #111;
    }
}

.finance-chart {
    display: grid;
    gap: 12px;
}

.finance-chart svg {
    width: 100%;
    min-height: 220px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.finance-chart line {
    stroke: #d1d5db;
    stroke-width: 1;
}

.finance-chart text {
    fill: #6b7280;
    font-size: 12px;
}

.finance-chart polyline {
    fill: none;
    stroke-width: 3;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.finance-chart .line-money {
    stroke: #0f766e;
}

.finance-chart .line-count {
    stroke: #2563eb;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: #4b5563;
    font-size: 13px;
}

.chart-legend span {
    align-items: center;
    display: inline-flex;
    gap: 6px;
}

.chart-legend i {
    border-radius: 999px;
    display: inline-block;
    height: 10px;
    width: 10px;
}

.legend-money {
    background: #0f766e;
}

.legend-count {
    background: #2563eb;
}

.legend-prizes {
    background: #d97706;
}

.legend-commission {
    background: #7c3aed;
}

.legend-profit {
    background: #16a34a;
}

.bar-chart {
    display: grid;
    gap: 12px;
}

.bar-row {
    display: grid;
    gap: 8px;
}

.bar-label {
    color: #111827;
    font-weight: 700;
}

.bar-track {
    background: #e5e7eb;
    border-radius: 999px;
    height: 12px;
    overflow: hidden;
}

.bar-track span {
    background: linear-gradient(90deg, #0f766e, #2563eb);
    display: block;
    height: 100%;
}

.bar-value {
    color: #374151;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.bar-value small {
    color: #6b7280;
}

.muted {
    color: #6b7280;
}

.admin-home {
    display: grid;
    gap: 18px;
}

.admin-home-filter {
    margin-bottom: 0;
}

.executive-kpis {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.executive-kpi {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 18px;
}

.executive-kpi span {
    color: #6b7280;
    display: block;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.executive-kpi strong {
    color: #111827;
    display: block;
    font-size: 30px;
    line-height: 1.1;
    margin-top: 8px;
}

.executive-kpi.positive {
    border-left: 5px solid #16a34a;
}

.executive-kpi.positive strong {
    color: #15803d;
}

.executive-kpi.negative {
    border-left: 5px solid #dc2626;
}

.executive-kpi.negative strong {
    color: #b91c1c;
}

.dashboard-main-chart,
.dashboard-card,
.dashboard-alerts,
.dashboard-details {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 18px;
}

.dashboard-main-chart {
    padding: 20px;
}

.executive-chart {
    border-top: 4px solid #0f766e;
}

.dashboard-block-head {
    align-items: flex-start;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    margin-bottom: 14px;
}

.dashboard-block-head span {
    color: #6b7280;
    display: block;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.dashboard-block-head strong {
    color: #111827;
    display: block;
    font-size: 26px;
    line-height: 1.15;
    margin-top: 3px;
}

.dashboard-block-head p {
    color: #6b7280;
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
}

.dashboard-chart {
    display: grid;
    gap: 12px;
}

.dashboard-chart svg {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    min-height: 260px;
    width: 100%;
}

.dashboard-chart line {
    stroke: #d1d5db;
    stroke-width: 1;
}

.dashboard-chart text {
    fill: #6b7280;
    font-size: 12px;
}

.dashboard-chart polyline {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 4;
}

.dashboard-chart .line-money {
    stroke: #0f766e;
}

.dashboard-chart .line-count {
    stroke: #2563eb;
}

.dashboard-chart .line-prizes {
    stroke: #d97706;
}

.dashboard-chart .line-commission {
    stroke: #7c3aed;
}

.dashboard-chart .line-profit {
    stroke: #16a34a;
}

.dashboard-kpis {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.dashboard-kpi {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-left: 4px solid #0f766e;
    border-radius: 8px;
    padding: 14px;
}

.dashboard-kpi.warn {
    border-left-color: #d97706;
}

.dashboard-kpi span {
    color: #6b7280;
    display: block;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.dashboard-kpi strong {
    color: #111827;
    display: block;
    font-size: 24px;
    line-height: 1.15;
    margin-top: 6px;
}

.dashboard-alerts {
    border-left: 4px solid #d97706;
}

.dashboard-alerts ul {
    display: grid;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.dashboard-alerts li,
.dashboard-alerts p {
    color: #374151;
    font-weight: 700;
    margin: 0;
}

.dashboard-alerts li::before {
    color: #d97706;
    content: "!";
    display: inline-block;
    font-weight: 900;
    margin-right: 8px;
}

.dashboard-columns {
    display: grid;
    gap: 16px;
}

.executive-sections,
.executive-tables {
    align-items: start;
}

.modalities-layout {
    align-items: center;
    display: grid;
    gap: 18px;
    grid-template-columns: 170px minmax(0, 1fr);
}

.dashboard-pie-wrap {
    min-width: 150px;
    position: relative;
    width: 160px;
}

.dashboard-pie-svg {
    display: block;
    height: auto;
    width: 100%;
}

.pie-slice {
    cursor: pointer;
    transition: filter 0.15s;
}

.pie-tooltip {
    background: #1e293b;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .28);
    color: #fff;
    display: flex;
    flex-direction: column;
    font-size: 12px;
    gap: 3px;
    line-height: 1.45;
    max-width: 190px;
    padding: 8px 11px;
    pointer-events: none;
    position: fixed;
    white-space: nowrap;
    z-index: 9999;
}

.pie-tt-name {
    font-size: 13px;
    margin-bottom: 2px;
}

.compact-ranking > div {
    grid-template-columns: 34px minmax(0, 1fr);
}

.compact-ranking em {
    grid-column: 2;
    text-align: left;
}

.dashboard-table-wrap {
    overflow-x: auto;
}

.dashboard-table {
    min-width: 620px;
}

.dashboard-table th {
    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
}

.dashboard-table td {
    color: #111827;
    font-weight: 700;
}

.dashboard-ranking {
    display: grid;
    gap: 10px;
}

.dashboard-ranking > div {
    align-items: center;
    border-bottom: 1px solid #eef2f7;
    display: grid;
    gap: 10px;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    min-height: 42px;
    padding-bottom: 10px;
}

.dashboard-ranking > div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.dashboard-ranking span {
    align-items: center;
    background: #eef2ff;
    border-radius: 999px;
    color: #1d4ed8;
    display: inline-flex;
    font-size: 12px;
    font-weight: 900;
    height: 28px;
    justify-content: center;
    width: 28px;
}

.dashboard-ranking strong {
    color: #111827;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-ranking em {
    color: #374151;
    font-style: normal;
    font-weight: 800;
    text-align: right;
    white-space: nowrap;
}

.dashboard-finance-summary {
    display: grid;
    gap: 10px;
}

.dashboard-finance-summary div {
    align-items: center;
    border-bottom: 1px solid #eef2f7;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding-bottom: 10px;
}

.dashboard-finance-summary div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.dashboard-finance-summary span {
    color: #6b7280;
    font-weight: 700;
}

.dashboard-finance-summary strong {
    color: #111827;
    font-size: 18px;
}

.dashboard-finance-panels {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 18px 0;
}

.finance-panel {
    border-left: 5px solid #475467;
}

.finance-panel-real.positive {
    border-left-color: #16803f;
}

.finance-panel-real.negative {
    border-left-color: #b42318;
}

.finance-panel-exposure {
    border-left-color: #d97706;
    background: #fffbeb;
}

.finance-panel-projected {
    border-left-color: #475467;
    background: #f8fafc;
}

.finance-panel-real.positive .dashboard-block-head strong {
    color: #16803f;
}

.finance-panel-real.negative .dashboard-block-head strong {
    color: #b42318;
}

.finance-panel-exposure .dashboard-block-head strong {
    color: #b45309;
}

.dashboard-details summary {
    cursor: pointer;
    font-weight: 900;
}

.dashboard-details .admin-actions {
    margin-top: 16px;
}

.quick-filter {
    align-items: end;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0 14px;
}

.quick-filter-buttons {
    display: inline-flex;
    gap: 6px;
}

.quick-filter button {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    color: #374151;
    cursor: pointer;
    font-weight: 800;
    min-height: 38px;
    padding: 8px 11px;
}

.quick-filter button.active {
    background: #111827;
    border-color: #111827;
    color: #fff;
}

.quick-filter label {
    color: #4b5563;
    display: grid;
    font-size: 12px;
    font-weight: 800;
    gap: 4px;
    text-transform: uppercase;
}

.quick-filter input {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    min-height: 38px;
    min-width: 150px;
    padding: 8px 10px;
}

[data-filter-item][hidden],
[data-filter-apuracao][hidden] {
    display: none !important;
}

.admin-item-list {
    display: grid;
    gap: 8px;
}

.admin-item-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.admin-item-card summary {
    align-items: center;
    cursor: pointer;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(180px, 1.3fr) minmax(170px, 1fr) minmax(150px, .9fr) auto;
    list-style: none;
    padding: 12px;
}

.admin-item-card summary::-webkit-details-marker {
    display: none;
}

.admin-item-main {
    display: grid;
    gap: 3px;
}

.admin-item-main strong {
    color: #111827;
    font-size: 15px;
}

.admin-item-main em,
.admin-item-card summary > span {
    color: #4b5563;
    font-style: normal;
    font-weight: 700;
}

.admin-item-details {
    border-top: 1px solid #eef2f7;
    display: grid;
    gap: 6px;
    padding: 12px;
}

.admin-item-details p {
    color: #374151;
    margin: 0;
}

.apuracao-compact-table {
    min-width: 980px;
}

.apuracao-compact-table th,
.apuracao-compact-table td {
    vertical-align: top;
}

.apuracao-compact-table td {
    white-space: nowrap;
}

.apuracao-compact-table td:nth-child(4),
.apuracao-compact-table td:nth-child(9) {
    white-space: normal;
}

.apuracao-details-cell {
    min-width: 128px;
}

.apuracao-details summary {
    color: #0f766e;
    cursor: pointer;
    font-weight: 900;
}

.apuracao-details div {
    display: grid;
    gap: 6px;
    margin-top: 8px;
    min-width: 280px;
}

.apuracao-details p {
    color: #374151;
    margin: 0;
    white-space: normal;
}

@media (max-width: 560px) {
    .dashboard-block-head {
        display: grid;
    }

    .dashboard-block-head p,
    .dashboard-ranking em {
        text-align: left;
        white-space: normal;
    }

    .dashboard-ranking > div {
        grid-template-columns: 34px minmax(0, 1fr);
    }

    .dashboard-ranking em {
        grid-column: 2;
    }

    .admin-item-card summary {
        align-items: start;
        grid-template-columns: 1fr;
    }

    .quick-filter,
    .quick-filter-buttons {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .quick-filter input {
        min-width: 0;
        width: 100%;
    }

    .apuracao-compact-wrap {
        overflow: visible;
    }

    .apuracao-compact-table {
        border-collapse: separate;
        border-spacing: 0 10px;
        min-width: 0;
    }

    .apuracao-compact-table thead {
        display: none;
    }

    .apuracao-compact-table,
    .apuracao-compact-table tbody,
    .apuracao-compact-table tr,
    .apuracao-compact-table td {
        display: block;
        width: 100%;
    }

    .apuracao-compact-table tr {
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        padding: 10px;
    }

    .apuracao-compact-table td {
        align-items: baseline;
        border: 0;
        display: flex;
        gap: 10px;
        justify-content: space-between;
        padding: 5px 0;
        white-space: normal;
    }

    .apuracao-compact-table td::before {
        color: #6b7280;
        content: attr(data-label);
        flex: 0 0 88px;
        font-size: 12px;
        font-weight: 800;
        text-transform: uppercase;
    }

    .apuracao-compact-table .apuracao-details-cell {
        display: block;
        min-width: 0;
    }

    .apuracao-compact-table .apuracao-details-cell::before {
        content: "";
        display: none;
    }

    .apuracao-details div {
        min-width: 0;
    }
}

@media (min-width: 720px) {
    .schema-row {
        grid-template-columns: 1fr 1fr auto;
        align-items: center;
    }
}

@media (min-width: 720px) {
    .page {
        padding: 36px 24px;
    }

    .topbar {
        padding: 16px 28px;
    }

    .admin-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .admin-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 900px) {
    .dashboard-columns {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .dashboard-finance-panels {
        grid-template-columns: 1fr;
    }

    .modalities-layout {
        grid-template-columns: 1fr;
    }

    .dashboard-pie-wrap {
        justify-self: center;
        width: min(210px, 70vw);
    }

    .recent-pule-row {
        grid-template-columns: 1fr auto;
    }

    .recent-pule-row em {
        grid-column: 1 / -1;
        justify-self: start;
    }
}

@media (min-width: 720px) {
    .admin-actions {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .section-head {
        grid-template-columns: 1fr auto;
        align-items: start;
    }

    .filter-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
        align-items: end;
    }

    .detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pos-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pos-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .result-preview {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media print {
    body * { visibility: hidden; }
    .pule, .pule * { visibility: visible; }
    .pule {
        position: absolute;
        left: 0; top: 0;
        width: 58mm;
        font-family: monospace;
        font-size: 11px;
    }
    .topbar, .pos-actions, header, nav, .offline-banner { display: none !important; }
    .pule h1 { font-size: 13px; text-align: center; }
    .pule-line { border-top: 1px dashed #000; margin: 3px 0; }
    .pule-total { font-weight: bold; border-top: 1px dashed #000; }
    /* Papel térmico é monocromático — sem fundo verde aqui, só o texto preto de sempre. */
    .pule-header-brand { background: none !important; padding: 0 !important; }
    .pule-header-brand h1 { color: #000 !important; }
}

.app-nav a.nav-active {
    background: rgba(255,255,255,0.13);
    color: #fff;
    border-left: 3px solid #4ade80;
    padding-left: 17px;
    font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
    .button, .pos-button, .link-button { transition: none; }
    .button:active, .pos-button:active, .link-button:active { transform: none; }
}

/* Apuração resumida */
.apuracao-resumo-lista {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.apuracao-resumo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    flex-wrap: wrap;
    font-size: 14px;
}
.apuracao-resumo-item.premiada {
    background: #f0fdf4;
    border-color: #bbf7d0;
}
.apuracao-resumo-data { color: var(--text-muted); font-size: 13px; }
.apuracao-resumo-detalhe { flex: 1; }
.apuracao-resumo-premio { font-weight: 700; color: #0f6b45; }

/* Resultado sorteado na apuração */
.resultado-loteria-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    font-size: 14px;
}
.resultado-loteria-label {
    font-weight: 600;
    color: #0369a1;
    white-space: nowrap;
}
.resultado-loteria-numeros {
    color: #1e293b;
    font-family: monospace;
    font-size: 13px;
}

/* Item de aposta sem expansão */
.admin-item-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    flex-wrap: wrap;
    font-size: 14px;
    margin-bottom: 8px;
}

/* Admin tabs */
.admin-abas {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0;
}
.admin-aba {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: 6px 6px 0 0;
    transition: color .15s;
}
.admin-aba:hover { color: #111827; }
.admin-aba-ativa { color: #0f6b45; border-bottom-color: #0f6b45; }

@media (min-width: 360px) and (max-width: 719px) {
    .pos-actions,
    .pos-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 719px) {
    .pos-button {
        min-height: 44px;
        font-size: 15px;
        border-radius: 10px;
    }

    input, select, textarea {
        font-size: 16px !important;
        min-height: 44px;
    }

    .sidebar, .nav-desktop {
        display: none;
    }

    .header { padding: 8px 12px; }

    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .card, .panel {
        border-radius: 0;
        margin: 0 0 8px 0;
    }
}

/* POS legacy compatibility: Android 6 / Chrome WebView 52 */
.auth-page {
    align-items: center;
    display: flex;
    justify-content: center;
}

/* Sem isso, o fallback flex acima sobrescreve o align-items:start definido na
   media query de celular/POS lá em cima (mesma regra .auth-page, especificidade
   igual, mas essa vem depois no arquivo e vence) — reabria o bug do teclado
   cobrindo o campo Senha na tela de login do POS. */
@media (max-width: 719px) {
    .auth-page {
        align-items: flex-start;
    }
}

.field,
.pos-shell,
.pos-hero,
.pos-form,
.pos-list,
.pos-row,
.secondary-summary,
.bet-summary,
.lottery-checks,
.praca-group .lottery-checks,
.final-lotteries,
.group-entry,
.value-mode,
.current-bet-summary,
.result-preview,
.section-head,
.filter-grid,
.detail-grid {
    display: block;
}

.field > *,
.pos-shell > *,
.pos-hero > *,
.pos-form > *,
.pos-list > *,
.group-entry > *,
.section-head > *,
.filter-grid > *,
.detail-grid > *,
.result-preview > * {
    margin-bottom: 10px;
}

.field > *:last-child,
.pos-shell > *:last-child,
.pos-hero > *:last-child,
.pos-form > *:last-child,
.pos-list > *:last-child,
.group-entry > *:last-child,
.section-head > *:last-child,
.filter-grid > *:last-child,
.detail-grid > *:last-child,
.result-preview > *:last-child {
    margin-bottom: 0;
}

.row-actions,
.admin-summary-strip,
.calendar-days,
.group-entry-progress,
.chart-legend,
.quick-filter,
.quick-filter-buttons,
.admin-abas,
.apuracao-resumo-lista,
.apuracao-resumo-item,
.resultado-loteria-box {
    display: flex;
    flex-wrap: wrap;
    margin-left: -4px;
    margin-right: -4px;
}

.row-actions > *,
.admin-summary-strip > *,
.calendar-days > *,
.group-entry-progress > *,
.chart-legend > *,
.quick-filter > *,
.quick-filter-buttons > *,
.admin-abas > *,
.apuracao-resumo-lista > *,
.apuracao-resumo-item > *,
.resultado-loteria-box > * {
    margin: 4px;
}

.pos-actions,
.pos-metrics,
.period-filter,
.quick-values,
.money-keypad {
    display: flex;
    flex-wrap: wrap;
    margin-left: -4px;
    margin-right: -4px;
}

.pos-actions > *,
.pos-metrics > *,
.period-filter > *,
.quick-values > *,
.money-keypad > * {
    box-sizing: border-box;
    margin: 4px;
}

.pos-actions > *,
.pos-metrics > * {
    flex: 0 0 calc(50% - 8px);
    max-width: calc(50% - 8px);
}

.period-filter > *,
.quick-values > *,
.money-keypad > * {
    flex: 0 0 calc(33.333% - 8px);
    max-width: calc(33.333% - 8px);
}

.lottery-checks label {
    margin-bottom: 8px;
}

.value-mode label,
.current-bet-summary div,
.bet-summary div,
.secondary-summary,
.pos-row,
.recent-pule-row,
.praca-group summary {
    margin-bottom: 8px;
}

.result-preview div {
    box-sizing: border-box;
}

@media (min-width: 720px) {
    .section-head,
    .detail-grid,
    .result-preview {
        display: flex;
        flex-wrap: wrap;
        margin-left: -5px;
        margin-right: -5px;
    }

    .section-head > *,
    .detail-grid > *,
    .result-preview > * {
        box-sizing: border-box;
        margin: 5px;
    }

    .section-head > *,
    .detail-grid > * {
        flex: 0 0 calc(50% - 10px);
        max-width: calc(50% - 10px);
    }

    .result-preview > * {
        flex: 0 0 calc(20% - 10px);
        max-width: calc(20% - 10px);
    }
}

/* ============================================================
   Mobile overrides — must come AFTER the global flex-wrap:wrap
   rules above so these declarations win on narrow viewports.
   ============================================================ */
@media (max-width: 719px) {

    /* Etapa 1 — Abas com rolagem horizontal */
    .admin-abas {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 0;
        padding-bottom: 1px;
        /* cancel margin-left/-right injected by the global group rule */
        margin-left: 0;
        margin-right: 0;
    }
    .admin-abas::-webkit-scrollbar { display: none; }
    .admin-abas > * { margin: 0 2px; }
    .admin-aba {
        flex-shrink: 0;
        white-space: nowrap;
    }

    /* Etapa 2 — Colunas de tabela opcionalmente ocultas */
    .col-hide-mobile { display: none !important; }

    /* Etapa 3/4 — Tabelas → cartões empilhados */
    .table-responsive-cards thead { display: none; }

    .table-responsive-cards tbody tr {
        display: block;
        margin-bottom: 10px;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: var(--surface);
        overflow: hidden;
    }

    .table-responsive-cards td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 8px;
        padding: 9px 12px;
        border-bottom: 1px solid var(--surface-strong);
        font-size: 13px;
        /* cancel any max-width / white-space / overflow set inline */
        max-width: none !important;
        overflow: visible !important;
        white-space: normal !important;
        text-overflow: clip !important;
    }

    .table-responsive-cards td:last-child { border-bottom: none; }

    .table-responsive-cards td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--muted);
        flex-shrink: 0;
        width: 45%;
        font-size: 12px;
        padding-top: 1px;
    }

    /* action cells: no label, right-aligned */
    .table-responsive-cards td[data-label=""]::before { display: none; }
    .table-responsive-cards td[data-label=""] { justify-content: flex-end; }

    /* separator rows (e.g. apostadores separador) stay full-width */
    .table-responsive-cards tr.separador-row td {
        display: block;
        font-weight: 700;
        background: var(--surface-strong);
        border-radius: 0;
        border-bottom: none;
    }
    .table-responsive-cards tr.separador-row td::before { display: none; }
}
