/* =========================================================
   UaiFlow OS — Portal do Técnico — Design System v2
   Tema dual (dark/light) via CSS variables
   ========================================================= */

/* ── Fonte de marca ──────────────────────────────────────── */
@font-face {
    font-family: 'Avant Garde';
    src: url('fonts/AvantGardeDemi.otf') format('opentype'),
         url('fonts/AvantGardeDemi.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* ── Tokens ─────────────────────────────────────────────── */
:root {
    --tp-bg:        #080c14; /* Deep dark obsidian */
    --tp-card:      rgba(15, 23, 42, 0.60); /* Translucent dark glass */
    --tp-card2:     rgba(30, 41, 59, 0.45); /* Inputs and inner items */
    --tp-border:    rgba(255, 255, 255, 0.08); /* Semi-transparent border */
    --tp-text:      #f8fafc;
    --tp-sub:       #94a3b8;
    --tp-muted:     #475569;
    --tp-accent:    #ea580c;
    --tp-green:     #16a34a;
    --tp-red:       #dc2626;
    --tp-blue:      #2563eb;
    --tp-glass:     rgba(15, 23, 42, 0.60);
    --glow-accent:  rgba(234, 88, 12, 0.25);
    --font-brand:   'Avant Garde', 'Inter', system-ui, -apple-system, sans-serif;
}

html.light-theme {
    --tp-bg:        #f1f5f9; /* Slate clear */
    --tp-card:      rgba(255, 255, 255, 0.70); /* Translucent white glass */
    --tp-card2:     rgba(241, 245, 249, 0.60);
    --tp-border:    rgba(15, 23, 42, 0.08);
    --tp-text:      #0f172a;
    --tp-sub:       #475569;
    --tp-muted:     #94a3b8;
    --tp-glass:     rgba(255, 255, 255, 0.70);
    --glow-accent:  rgba(234, 88, 12, 0.15);
}

html.light-theme .tp-header {
    background: var(--tp-card);
}

html.light-theme .tp-card {
    box-shadow: 0 24px 70px rgba(15,23,42,.10), inset 0 1px 0 rgba(255,255,255,.7);
}

/* ── Base ────────────────────────────────────────────────── */
body {
    background:
        radial-gradient(circle at 18% -10%, rgba(59,130,246,.18), transparent 32rem),
        radial-gradient(circle at 82% 0%, rgba(255,90,31,.12), transparent 30rem),
        var(--tp-bg) !important;
    color: var(--tp-text) !important;
    transition: background-color 0.2s, color 0.2s;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* v237 - Sprint SaaS/IA: botoes RAT, overlay de bloqueio e mobile */
.tp-inline-actions,
.tp-field-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.tp-ai-action {
    min-height: 40px;
    padding: 0.48rem 0.78rem !important;
    font-size: 0.62rem !important;
    line-height: 1;
    white-space: nowrap;
}

.tp-ai-action i,
.tp-ai-action span {
    pointer-events: none;
}

.tp-ai-action.is-loading {
    opacity: 0.78;
    cursor: wait;
}

.tp-saas-locked {
    overflow: hidden !important;
}

.tp-saas-lock {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 1rem;
    background:
        radial-gradient(circle at 50% 15%, rgba(249, 115, 22, 0.18), transparent 24rem),
        rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(18px) saturate(130%);
    -webkit-backdrop-filter: blur(18px) saturate(130%);
}

.tp-saas-lock-card {
    width: min(100%, 520px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 1.5rem;
    padding: 1.35rem;
    background: rgba(15, 23, 42, 0.80);
    color: #f8fafc;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.tp-saas-lock-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #fb923c, #ea580c);
    box-shadow: 0 18px 34px rgba(234, 88, 12, 0.28);
}

.tp-saas-kicker {
    margin-top: 1rem;
    color: #fb923c;
    font-size: 0.62rem;
    font-weight: 950;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.tp-saas-lock-card h2 {
    margin: 0.25rem 0 0;
    font-size: clamp(1.45rem, 5vw, 2rem);
    line-height: 1.08;
    font-weight: 950;
    letter-spacing: 0;
}

.tp-saas-lock-card p {
    color: #cbd5e1;
}

.tp-saas-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
    margin: 1rem 0;
}

.tp-saas-meta > div {
    min-width: 0;
    border: 1px solid rgba(148, 163, 184, 0.20);
    border-radius: 0.9rem;
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.52);
}

.tp-saas-meta span,
.tp-saas-meta strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tp-saas-meta span {
    color: #94a3b8;
    font-size: 0.56rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.tp-saas-meta strong {
    margin-top: 0.25rem;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 900;
}

.tp-saas-actions {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 0.65rem;
}

#historico-list > li.tp-card {
    min-height: 64px;
}

#historico-list a,
#historico-list button {
    min-height: 40px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

@media (max-width: 640px) {
    .portal-main {
        padding: 14px 10px 28px;
    }

    .tp-card-body {
        padding: 1rem;
    }

    .tp-inline-actions,
    .tp-field-title-row {
        width: 100%;
        align-items: stretch;
    }

    .tp-inline-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .tp-field-title-row .tp-ai-action {
        width: 100%;
        justify-content: center;
    }

    .tp-ai-action {
        min-height: 44px;
        white-space: normal;
    }

    .tp-saas-lock-card {
        border-radius: 1.2rem;
        padding: 1rem;
    }

    .tp-saas-meta,
    .tp-saas-actions {
        grid-template-columns: 1fr;
    }

    #historico-modal {
        padding: 0 !important;
    }

    #historico-list > li.tp-card {
        align-items: stretch !important;
        flex-direction: column;
        gap: 0.75rem !important;
    }

    #historico-list a,
    #historico-list button {
        width: 100%;
        min-height: 44px;
        border-radius: 0.85rem !important;
    }
}

.hidden { display: none !important; }

.portal-wrap { width: 100%; max-width: 760px; margin: 0 auto; }
.portal-header-inner {
    min-height: 74px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.portal-brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.portal-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 10px 18px rgba(0,0,0,.18));
}
.portal-title {
    color: var(--tp-text);
    font-family: var(--font-brand);
    font-size: 15px;
    font-weight: 950;
    line-height: 1;
    letter-spacing: -0.015em;
    text-transform: uppercase;
    font-style: italic;
    white-space: nowrap;
}
.portal-subtitle {
    color: var(--tp-accent);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .16em;
    text-transform: uppercase;
    margin-top: 4px;
}
.portal-actions { display: flex; align-items: center; gap: 8px; }
.portal-chip {
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--tp-sub);
    font-size: 10px;
    font-weight: 700;
}
.portal-main { width: 100%; max-width: 760px; margin: 0 auto; padding: 24px 18px 40px; }

@media (max-width: 820px) {
    .portal-chip { display: none !important; }
}

/* ── Cards ───────────────────────────────────────────────── */
.tp-card {
    background: var(--tp-glass) !important;
    border: 1px solid var(--tp-border) !important;
    border-radius: 1.25rem !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1), 
                border-color 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                background-color 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
    overflow: hidden;
}
.tp-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(251, 146, 60, 0.25) !important;
}
.tp-card-hdr {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--tp-border) !important;
    background: rgba(30, 41, 59, 0.15) !important;
}
.tp-card-body { padding: 1.25rem; }

/* ── Controle de ponto ──────────────────────────────────── */
.ponto-card {
    border-color: rgba(234,88,12,.28);
}
.ponto-card-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.ponto-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}
.ponto-title-icon {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    background: linear-gradient(135deg, #fb923c, #ea580c);
    box-shadow: 0 14px 26px rgba(234,88,12,.26), inset 0 1px 0 rgba(255,255,255,.28);
}
.ponto-kicker {
    margin: 0 0 0.15rem;
    color: var(--tp-accent);
    font-size: 0.58rem;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: .14em;
}
.ponto-title {
    margin: 0;
    color: var(--tp-text);
    font-size: 0.95rem;
    font-weight: 950;
    line-height: 1.05;
    text-transform: uppercase;
}
.ponto-card-body {
    display: grid;
    gap: 1rem;
}
.ponto-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
}
.ponto-step {
    min-height: 3rem;
    padding: 0.65rem 0.7rem;
    border: 1px solid var(--tp-border);
    border-radius: 0.9rem;
    background: rgba(148,163,184,.08);
    color: var(--tp-sub);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    text-align: center;
    font-size: 0.61rem;
    font-weight: 900;
    text-transform: uppercase;
}
.ponto-step i {
    color: var(--tp-accent);
    font-size: 0.75rem;
}
.ponto-field {
    display: grid;
    gap: 0.35rem;
}
.ponto-select-wrap {
    position: relative;
}
.ponto-select-wrap > i {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    color: var(--tp-accent);
    pointer-events: none;
}
.tp-input.ponto-select {
    padding-left: 2.45rem;
    min-height: 3rem;
}
.ponto-capture-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 1rem;
    border: 1px dashed rgba(234,88,12,.35);
    border-radius: 1.25rem;
    background: rgba(234,88,12,.06);
}
.ponto-media {
    width: min(100%, 22rem);
    aspect-ratio: 4 / 3;
    border-radius: 1rem;
    object-fit: cover;
    background: #020617;
    border: 1px solid rgba(234,88,12,.28);
}
.ponto-media-btn {
    min-height: 2.45rem;
    padding: 0.7rem 1rem;
    font-size: 0.58rem;
    font-weight: 950;
    color: var(--tp-text);
}
.ponto-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}
.ponto-action-btn {
    min-height: 4rem;
    padding: 0.95rem;
    border-radius: 1.15rem;
    font-size: 0.72rem;
    letter-spacing: .1em;
}
.ponto-action-btn i {
    font-size: 0.82rem;
}
.ponto-entry {
    background: linear-gradient(135deg, #16a34a, #059669);
    box-shadow: 0 18px 32px rgba(5,150,105,.24), inset 0 1px 0 rgba(255,255,255,.22);
}
.ponto-entry:hover:not(:disabled) {
    background: linear-gradient(135deg, #15803d, #047857);
}
.ponto-exit {
    background: linear-gradient(135deg, #f43f5e, #dc2626);
    box-shadow: 0 18px 32px rgba(220,38,38,.20), inset 0 1px 0 rgba(255,255,255,.22);
}
.ponto-exit:hover:not(:disabled) {
    background: linear-gradient(135deg, #e11d48, #b91c1c);
}
.ponto-pause-btn {
    grid-column: 1 / -1;
    min-height: 2.75rem;
    opacity: .78;
}
.ponto-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--tp-sub);
    font-size: 0.68rem;
    font-weight: 700;
    text-align: center;
}
.ponto-note i {
    color: var(--tp-blue);
}
.ponto-error-msg {
    color: #f87171;
    font-size: 0.7rem;
    font-weight: 800;
    text-align: center;
}

/* ── Header ──────────────────────────────────────────────── */
.tp-header {
    background: rgba(11,15,26,.72);
    border-bottom: 1px solid var(--tp-border);
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(22px) saturate(1.25);
    -webkit-backdrop-filter: blur(22px) saturate(1.25);
    transition: background 0.2s, border-color 0.2s;
}
.tp-icon-btn {
    width: 2.375rem; height: 2.375rem;
    border-radius: 0.875rem;
    display: flex; align-items: center; justify-content: center;
    background: var(--tp-card2);
    color: var(--tp-sub);
    border: 1px solid var(--tp-border);
    transition: all 0.15s;
    cursor: pointer;
}
.tp-icon-btn:hover { color: var(--tp-text); border-color: var(--tp-sub); }
.tp-icon-btn.danger:hover { color: #f87171; border-color: rgba(248,113,113,0.4); }

/* ── Forms ───────────────────────────────────────────────── */
.tp-label {
    display: block;
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--tp-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.35rem;
    transition: color 0.2s;
}
.tp-input {
    background: var(--tp-card2) !important;
    color: var(--tp-text) !important;
    border: 1px solid var(--tp-border) !important;
    border-radius: 0.75rem !important;
    padding-top: 0.7rem !important;
    padding-bottom: 0.7rem !important;
    padding-right: 1rem !important;
    padding-left: 1rem;
    width: 100%;
    font-size: 0.875rem;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
.tp-input:focus {
    outline: none !important;
    border-color: var(--tp-accent) !important;
    box-shadow: 0 0 14px var(--glow-accent), inset 0 1px 0 rgba(255, 255, 255, 0.03) !important;
    background-color: rgba(30, 41, 59, 0.65) !important;
}
textarea.tp-input { resize: vertical; }
.tp-input::placeholder { color: var(--tp-muted); }
.tp-input-readonly {
    background: rgba(148, 163, 184, 0.12) !important;
    color: var(--tp-sub) !important;
    cursor: not-allowed;
}
.tp-input-readonly:focus {
    border-color: var(--tp-border) !important;
}

/* ── Signature ───────────────────────────────────────────── */
.sig-wrap {
    background: #ffffff;
    border: 2px dashed var(--tp-border);
    border-radius: 0.5rem;
    overflow: hidden;
}
.sig-wrap canvas { display: block; width: 100%; height: 160px; touch-action: none; }
.sig-wrap-large canvas { height: 230px; }
@media (max-width: 640px) {
    .sig-wrap-large canvas { height: 260px; }
}
.tp-clear-btn {
    margin-top: 0.4rem;
    padding: 0.35rem 0.875rem;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-radius: 0.4rem;
    background: var(--tp-card2);
    color: var(--tp-sub);
    border: 1px solid var(--tp-border);
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex; align-items: center; gap: 0.35rem;
}
.tp-clear-btn:hover { color: var(--tp-text); }

/* ── GPS card ────────────────────────────────────────────── */
.tp-gps-card {
    background: rgba(234,88,12,0.07);
    border: 1px solid rgba(234,88,12,0.25);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    display: flex; align-items: center; gap: 0.75rem;
}

/* ── Action button ───────────────────────────────────────── */
.tp-btn {
    width: 100%;
    padding: 1.1rem;
    font-weight: 900;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-radius: 1rem;
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 0.625rem;
    color: white;
    transition: all 0.2s;
    box-shadow: 0 18px 36px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,.14);
}
.tp-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.tp-btn.state-pending   { background: var(--tp-blue); }
.tp-btn.state-pending:hover:not(:disabled)   { background: #1d4ed8; }
.tp-btn.state-tracking  { background: var(--tp-accent); }
.tp-btn.state-tracking:hover:not(:disabled)  { background: #c2410c; }
.tp-btn.state-servicing { background: var(--tp-green); }
.tp-btn.state-servicing:hover:not(:disabled) { background: #15803d; }
.tp-btn.state-submitted { background: #374151; }

/* ── Status badges ───────────────────────────────────────── */
.tp-badge {
    padding: 0.45rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.625rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.badge-pending  { background: rgba(234,179,8,0.15); color: #eab308; border: 1px solid rgba(234,179,8,0.35); }
.badge-tracking { background: rgba(249,115,22,0.15); color: #f97316; border: 1px solid rgba(249,115,22,0.35); }
.badge-service  { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.35); }
.badge-done     { background: rgba(34,197,94,0.15);  color: #22c55e; border: 1px solid rgba(34,197,94,0.35); }

/* ── Log ─────────────────────────────────────────────────── */
.tp-log {
    background: var(--tp-card2);
    border: 1px solid var(--tp-border);
    border-radius: 0.5rem;
    padding: 0.75rem 0.875rem;
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    max-height: 120px;
    overflow-y: auto;
    color: var(--tp-sub);
    line-height: 1.7;
    transition: background 0.2s, border-color 0.2s;
}
.tp-log::-webkit-scrollbar { width: 4px; }
.tp-log::-webkit-scrollbar-thumb { background: var(--tp-border); border-radius: 2px; }

/* ── Expenses ────────────────────────────────────────────── */
.tp-expense-item {
    background: var(--tp-card2);
    border: 1px solid var(--tp-border);
    border-left: 3px solid var(--tp-accent);
    border-radius: 0.5rem;
    padding: 0.6rem 0.875rem;
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.5rem;
}
.tp-expense-del {
    width: 1.5rem; height: 1.5rem;
    border-radius: 0.35rem;
    background: rgba(220,38,38,0.1);
    color: #f87171;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.625rem;
    transition: background 0.15s;
}
.tp-expense-del:hover { background: rgba(220,38,38,0.25); }

.tp-equipment-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.72rem 0.85rem;
    border-radius: 0.85rem;
    border: 1px solid var(--tp-border);
    background: var(--tp-card2);
}
.tp-equipment-pill p {
    color: var(--tp-text);
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tp-equipment-pill span {
    display: block;
    margin-top: 0.18rem;
    color: var(--tp-sub);
    font-size: 0.62rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tp-mini-btn {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.55rem;
    border: 1px solid var(--tp-border);
    background: rgba(148,163,184,.08);
    color: var(--tp-sub);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tp-mini-btn:hover { color: var(--tp-text); border-color: var(--tp-sub); }
.tp-mini-btn.danger:hover { color: #f87171; border-color: rgba(248,113,113,.45); }
.tp-photo-thumb {
    position: relative;
    overflow: hidden;
    border-radius: 0.85rem;
    border: 1px solid var(--tp-border);
    background: var(--tp-card2);
}
.tp-photo-thumb img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}
.tp-photo-thumb button {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 999px;
    background: rgba(15,23,42,.78);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
}
.tp-photo-thumb span {
    display: block;
    padding: 0.42rem;
    color: var(--tp-sub);
    font-size: 0.55rem;
    font-weight: 800;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Secondary button ────────────────────────────────────── */
.tp-btn-sec {
    display: flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.625rem 1rem;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-radius: 0.5rem;
    background: var(--tp-card2);
    color: var(--tp-sub);
    border: 1px solid var(--tp-border);
    cursor: pointer;
    transition: all 0.15s;
}
.tp-btn-sec:hover { color: var(--tp-text); border-color: var(--tp-sub); }

/* ── Modal ───────────────────────────────────────────────── */
.tp-modal-bg {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 50;
    display: flex; align-items: flex-end; justify-content: center;
    padding: 1rem;
}
@media (min-width: 640px) {
    .tp-modal-bg { align-items: center; }
}

/* ── OS info lines ───────────────────────────────────────── */
.tp-os-line {
    display: flex; align-items: flex-start; gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--tp-text);
    transition: color 0.2s;
}
.tp-os-icon {
    width: 1rem; text-align: center;
    color: var(--tp-accent);
    flex-shrink: 0;
    margin-top: 0.1rem;
}
.tp-os-diagnostics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--tp-border);
}
.tp-os-diagnostics div {
    min-width: 0;
    padding: 0.75rem;
    border-radius: 0.9rem;
    background: rgba(148,163,184,.08);
    border: 1px solid var(--tp-border);
}
.tp-os-diagnostics p {
    margin: 0 0 0.35rem;
    color: var(--tp-muted);
    font-size: 0.58rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.tp-os-diagnostics span {
    display: block;
    color: var(--tp-text);
    font-size: 0.78rem;
    font-weight: 650;
    line-height: 1.4;
}

/* ── Scrollbar hide ──────────────────────────────────────── */
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

/* Mobile polish: mantem o visual premium sem desperdiçar largura */
@media (max-width: 640px) {
    body {
        background:
            radial-gradient(circle at 10% -8%, rgba(37,99,235,.20), transparent 16rem),
            radial-gradient(circle at 92% 4%, rgba(234,88,12,.14), transparent 15rem),
            linear-gradient(180deg, rgba(255,255,255,.03), transparent 18rem),
            var(--tp-bg) !important;
    }

    .portal-wrap { max-width: none; }

    .portal-header-inner {
        min-height: 68px;
        padding: 10px 14px;
        gap: 10px;
    }

    .portal-brand {
        flex: 1 1 auto;
        gap: 10px;
        min-width: 0;
    }

    .portal-logo {
        width: 42px;
        height: 42px;
    }

    .portal-title {
        font-size: 13px;
        line-height: .95;
        letter-spacing: -0.01em;
        white-space: nowrap;
    }

    .portal-subtitle {
        font-size: 8px;
        line-height: 1.15;
        letter-spacing: .13em;
        white-space: nowrap;
        margin-top: 3px;
    }

    .portal-actions {
        flex: 0 0 auto;
        gap: 6px;
    }

    .portal-chip {
        display: none !important;
    }

    .tp-icon-btn {
        width: 2.55rem;
        height: 2.55rem;
        border-radius: 1rem;
        background: rgba(248,250,252,.74);
        box-shadow: 0 10px 26px rgba(15,23,42,.10), inset 0 1px 0 rgba(255,255,255,.9);
    }

    html:not(.light-theme) .tp-icon-btn {
        background: rgba(15,21,32,.82);
    }

    .portal-main {
        padding: 16px 12px 34px;
        gap: 12px;
    }

    .tp-card {
        border-radius: 1.35rem;
        box-shadow: 0 16px 44px rgba(15,23,42,.12), inset 0 1px 0 rgba(255,255,255,.18);
    }

    .tp-card-hdr {
        padding: 0.85rem 0.95rem;
        gap: 0.65rem;
        align-items: flex-start;
    }

    .tp-card-hdr h2,
    .tp-card-hdr h3 {
        font-size: 0.74rem !important;
        line-height: 1.25;
        letter-spacing: .12em;
    }

    .tp-card-body {
        padding: 1rem 0.95rem;
    }

    .ponto-card-hdr {
        align-items: center;
    }

    .ponto-title-icon {
        width: 2.25rem;
        height: 2.25rem;
        border-radius: 0.9rem;
    }

    .ponto-title {
        font-size: 0.82rem !important;
        letter-spacing: 0 !important;
    }

    .ponto-kicker {
        font-size: 0.52rem;
    }

    .ponto-steps {
        grid-template-columns: 1fr;
        gap: 0.45rem;
    }

    .ponto-step {
        min-height: 2.55rem;
        justify-content: flex-start;
        text-align: left;
        padding: 0.58rem 0.72rem;
    }

    .ponto-action-grid {
        gap: 0.55rem;
    }

    .ponto-action-btn {
        min-height: 3.8rem;
        border-radius: 1rem;
        font-size: 0.68rem;
    }

    .ponto-media {
        width: 100%;
    }

    .tp-badge {
        padding: 0.38rem 0.62rem;
        font-size: 0.52rem;
        letter-spacing: .07em;
        text-align: center;
        white-space: nowrap;
    }

    .tp-os-line {
        gap: 0.65rem;
        font-size: 0.84rem;
        line-height: 1.35;
    }

    .tp-os-icon {
        width: 1.5rem;
        height: 1.5rem;
        margin-top: -0.1rem;
        border-radius: 0.55rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: rgba(234,88,12,.10);
    }

    .tp-os-diagnostics {
        grid-template-columns: 1fr;
        gap: 0.55rem;
    }

    .tp-btn {
        min-height: 58px;
        padding: 0.95rem 1rem;
        border-radius: 1.15rem;
        font-size: 0.76rem;
        letter-spacing: .08em;
        box-shadow: 0 16px 30px rgba(15,23,42,.16), inset 0 1px 0 rgba(255,255,255,.18);
    }

    .tp-log {
        max-height: 84px;
        border-radius: 1rem;
        padding: 0.7rem 0.8rem;
        font-size: 0.62rem;
        line-height: 1.55;
        opacity: .86;
    }

    .tp-input {
        min-height: 48px;
        border-radius: 0.85rem;
        font-size: 0.92rem;
        padding: 0.75rem 0.9rem;
    }

    .tp-label {
        font-size: 0.57rem;
        letter-spacing: .11em;
    }

    .tp-btn-sec {
        border-radius: 0.85rem;
        min-height: 42px;
    }

    .tp-photo-thumb {
        border-radius: 1rem;
    }

    footer p {
        padding: 0 1rem;
        line-height: 1.7;
        letter-spacing: .25em !important;
    }
}

@media (max-width: 380px) {
    .portal-title { font-size: 12px; }
    .portal-subtitle { font-size: 7px; letter-spacing: .1em; }
    .portal-logo { width: 38px; height: 38px; }
    .tp-icon-btn { width: 2.35rem; height: 2.35rem; }
}

/* ── Custom Scrollbars & Theme Overrides ─────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.22);
    border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.45);
}

/* Button & Icon Button micro-interactions */
.tp-icon-btn, .tp-btn, .tp-btn-sec, .tp-clear-btn {
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
.tp-icon-btn:active, .tp-btn:active, .tp-btn-sec:active, .tp-clear-btn:active {
    transform: scale(0.97);
}
