/* TM01GPT_BRANDING_AUTORITARIO_2599B */

/* ORIGEM: global.css */
/* ============================================================
   TM01GPT — GLOBAL CSS
   Interface responsiva — PC / Tablet / Smartphone
   ============================================================ */

:root {
    --tm-bg: #080b10;
    --tm-bg-2: #0d1118;
    --tm-panel: #11161f;
    --tm-panel-2: #161c26;
    --tm-border: #252d39;

    --tm-text: #f1f3f6;
    --tm-muted: #8c96a5;
    --tm-soft: #b7bfca;

    --tm-accent: #e83e8c;
    --tm-accent-hover: #f0529b;
    --tm-accent-dark: #a92663;

    --tm-user: #18202b;
    --tm-assistant: #10151d;

    --tm-radius: 14px;
    --tm-radius-small: 9px;

    --tm-shadow: 0 18px 50px rgba(0, 0, 0, .35);

    --tm-header-height: 72px;
}


/* ============================================================
   RESET
   ============================================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--tm-bg);
    color-scheme: dark;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;

    background:
        radial-gradient(
            circle at 50% -10%,
            rgba(232, 62, 140, .09),
            transparent 38%
        ),
        var(--tm-bg);

    color: var(--tm-text);

    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
textarea,
select,
input {
    font: inherit;
}

img,
svg {
    max-width: 100%;
}


/* ============================================================
   APP
   ============================================================ */

.tm-app {
    min-height: 100vh;
}


/* ============================================================
   HEADER
   ============================================================ */

.tm-header {
    position: sticky;
    top: 0;
    z-index: 50;

    min-height: var(--tm-header-height);

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 16px;

    padding: 10px clamp(14px, 4vw, 32px);

    background: rgba(8, 11, 16, .90);

    border-bottom: 1px solid var(--tm-border);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.tm-brand {
    min-width: 0;

    display: flex;
    align-items: center;
    gap: 12px;
}

.tm-brand-mark {
    flex: 0 0 auto;

    width: 40px;
    height: 40px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 10px;

    background:
        linear-gradient(
            135deg,
            var(--tm-accent),
            var(--tm-accent-dark)
        );

    color: white;

    font-size: 14px;
    font-weight: 800;

    box-shadow:
        0 8px 24px rgba(232, 62, 140, .22);
}

.tm-brand-name {
    overflow: hidden;

    font-size: 16px;
    font-weight: 700;
    letter-spacing: .02em;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.tm-brand-subtitle {
    margin-top: 1px;

    color: var(--tm-muted);

    font-size: 12px;
}


/* ============================================================
   BUTTONS
   ============================================================ */

.tm-button {
    flex: 0 0 auto;

    min-height: 42px;
    min-width: 42px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0 18px;

    border: 1px solid transparent;
    border-radius: 9px;

    background: var(--tm-accent);

    color: white;

    font-size: 14px;
    font-weight: 650;

    cursor: pointer;

    transition:
        background .18s ease,
        transform .18s ease,
        box-shadow .18s ease;
}

.tm-button:hover {
    background: var(--tm-accent-hover);

    box-shadow:
        0 8px 24px rgba(232, 62, 140, .22);

    transform: translateY(-1px);
}

.tm-button:active {
    transform: translateY(0);
}

.tm-button:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}


/* ============================================================
   MAIN
   ============================================================ */

.tm-main {
    min-height: calc(100vh - var(--tm-header-height));

    padding:
        clamp(20px, 4vw, 38px)
        clamp(10px, 4vw, 24px)
        60px;
}

.tm-container {
    width: min(1180px, 100%);
    margin: 0 auto;
}


/* ============================================================
   HOME
   ============================================================ */

.tm-eyebrow {
    color: var(--tm-accent);

    font-size: 12px;
    font-weight: 800;

    letter-spacing: .16em;
    text-transform: uppercase;
}

.tm-title {
    margin: 8px 0 10px;

    font-size: clamp(38px, 7vw, 68px);
    line-height: 1;

    letter-spacing: -.04em;
}

.tm-subtitle {
    color: var(--tm-muted);
    font-size: clamp(14px, 2vw, 16px);
}

.tm-card {
    margin-top: 38px;

    padding: clamp(18px, 4vw, 28px);

    background: var(--tm-panel);

    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius);

    box-shadow: var(--tm-shadow);
}

.tm-home-card h2 {
    margin-top: 0;
}


/* ============================================================
   CHAT
   ============================================================ */

.tm-chat {
    width: 100%;

    display: flex;
    flex-direction: column;

    min-height: calc(100vh - 150px);

    overflow: hidden;

    background: var(--tm-panel);

    border: 1px solid var(--tm-border);
    border-radius: 18px;

    box-shadow: var(--tm-shadow);
}


/* ============================================================
   CHAT HEADER
   ============================================================ */

.tm-chat-header {
    min-height: 78px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    padding: 16px 22px;

    background: var(--tm-panel-2);

    border-bottom: 1px solid var(--tm-border);
}

.tm-chat-title {
    font-size: 17px;
    font-weight: 750;
}

.tm-chat-status {
    display: flex;
    align-items: center;
    gap: 7px;

    margin-top: 3px;

    color: var(--tm-muted);
    font-size: 12px;
}

.tm-chat-status::before {
    content: "";

    width: 7px;
    height: 7px;

    flex: 0 0 auto;

    border-radius: 50%;

    background: #38d996;

    box-shadow:
        0 0 9px rgba(56, 217, 150, .5);
}


/* ============================================================
   MODEL
   ============================================================ */

.tm-model {
    min-width: 0;

    display: flex;
    align-items: center;

    gap: 10px;
}

.tm-model label {
    flex: 0 0 auto;

    color: var(--tm-muted);
    font-size: 12px;
}

.tm-model select {
    min-width: 190px;
    max-width: 100%;

    padding: 9px 34px 9px 11px;

    border: 1px solid var(--tm-border);
    border-radius: 8px;

    background: var(--tm-bg-2);
    color: var(--tm-text);

    outline: none;

    cursor: pointer;
}

.tm-model select:focus {
    border-color: var(--tm-accent);
}


/* ============================================================
   MESSAGES
   ============================================================ */

.tm-messages {
    flex: 1;

    min-height: 420px;

    overflow-y: auto;
    overflow-x: hidden;

    padding: clamp(16px, 4vw, 28px);

    background:
        radial-gradient(
            circle at 50% 0,
            rgba(232, 62, 140, .035),
            transparent 45%
        ),
        var(--tm-bg-2);

    overscroll-behavior: contain;

    scrollbar-gutter: stable;
}

.tm-message {
    width: min(820px, 100%);

    margin-bottom: 24px;

    animation: tm-message-in .2s ease;
}

@keyframes tm-message-in {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tm-message-role {
    margin-bottom: 7px;

    color: var(--tm-muted);

    font-size: 11px;
    font-weight: 750;

    letter-spacing: .08em;
    text-transform: uppercase;
}

.tm-message-content {
    width: 100%;

    padding: 14px 17px;

    border: 1px solid var(--tm-border);
    border-radius: 12px;

    background: var(--tm-assistant);

    color: var(--tm-text);

    font-size: 14px;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.tm-message-user {
    margin-left: auto;
}

.tm-message-user .tm-message-role {
    text-align: right;
}

.tm-message-user .tm-message-content {
    background: var(--tm-user);
    border-color: #303a48;
}


/* ============================================================
   CHAT FORM
   ============================================================ */

.tm-chat-form {
    display: flex;
    align-items: flex-end;

    gap: 12px;

    padding: 16px 18px;

    background: var(--tm-panel);

    border-top: 1px solid var(--tm-border);
}

.tm-chat-input {
    flex: 1;

    width: 100%;
    min-width: 0;

    min-height: 52px;
    max-height: 180px;

    resize: vertical;

    padding: 14px 15px;

    border: 1px solid var(--tm-border);
    border-radius: 10px;

    background: var(--tm-bg);
    color: var(--tm-text);

    outline: none;

    font-size: 14px;
    line-height: 1.5;

    transition:
        border-color .18s ease,
        box-shadow .18s ease;
}

.tm-chat-input::placeholder {
    color: #657080;
}

.tm-chat-input:focus {
    border-color: var(--tm-accent);

    box-shadow:
        0 0 0 3px rgba(232, 62, 140, .10);
}

.tm-chat-form .tm-button {
    min-width: 100px;
}


/* ============================================================
   TABLET
   ============================================================ */

@media (max-width: 1024px) {

    .tm-container {
        width: 100%;
    }

    .tm-chat {
        min-height: calc(100vh - 135px);
    }

    .tm-chat-header {
        padding: 15px 18px;
    }

    .tm-messages {
        min-height: 380px;
    }
}


/* ============================================================
   SMARTPHONE
   ============================================================ */

@media (max-width: 700px) {

    :root {
        --tm-header-height: 64px;
    }

    .tm-header {
        padding: 8px 12px;
    }

    .tm-brand {
        gap: 9px;
    }

    .tm-brand-mark {
        width: 36px;
        height: 36px;
        border-radius: 9px;
    }

    .tm-brand-name {
        font-size: 15px;
    }

    .tm-brand-subtitle {
        display: none;
    }

    .tm-header .tm-button {
        min-height: 38px;
        padding: 0 13px;
        font-size: 13px;
    }

    .tm-main {
        padding: 10px 8px 20px;
    }

    .tm-card {
        margin-top: 24px;
    }

    .tm-chat {
        min-height: calc(100dvh - 84px);
        border-radius: 12px;
    }

    .tm-chat-header {
        align-items: stretch;
        flex-direction: column;

        gap: 12px;

        padding: 13px;
    }

    .tm-model {
        width: 100%;
    }

    .tm-model select {
        flex: 1;

        min-width: 0;
        width: 100%;
    }

    .tm-messages {
        min-height: 0;
        padding: 16px 11px;
    }

    .tm-message {
        margin-bottom: 18px;
    }

    .tm-message-content {
        padding: 12px 13px;
        font-size: 14px;
    }

    .tm-chat-form {
        align-items: stretch;
        flex-direction: column;

        gap: 8px;

        padding: 10px;
    }

    .tm-chat-input {
        min-height: 48px;
        max-height: 150px;
    }

    .tm-chat-form .tm-button {
        width: 100%;
        min-width: 0;
        min-height: 44px;
    }
}


/* ============================================================
   SMARTPHONE PEQUENO
   ============================================================ */

@media (max-width: 380px) {

    .tm-header .tm-button {
        padding: 0 10px;
    }

    .tm-brand-name {
        font-size: 14px;
    }

    .tm-chat-title {
        font-size: 16px;
    }

    .tm-model {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    .tm-model select {
        width: 100%;
    }
}


/* ============================================================
   TOUCH
   ============================================================ */

@media (hover: none) {

    .tm-button:hover {
        transform: none;
        box-shadow: none;
        background: var(--tm-accent);
    }

    .tm-button:active {
        background: var(--tm-accent-hover);
    }
}


/* ============================================================
   ACESSIBILIDADE
   ============================================================ */

:focus-visible {
    outline: 2px solid var(--tm-accent);
    outline-offset: 2px;
}


/* ============================================================
   SCROLLBAR
   ============================================================ */

::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

::-webkit-scrollbar-track {
    background: var(--tm-bg);
}

::-webkit-scrollbar-thumb {
    background: #303846;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #414c5d;
}


/* ============================================================
   REDUZIR ANIMAÇÕES
   ============================================================ */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* ========================================================
   TM01GPT — DATA/HORA DAS MENSAGENS
   ======================================================== */

.tm-message-time {
    margin-top: 6px;
    font-size: 0.72rem;
    opacity: 0.55;
    text-align: right;
    user-select: none;
}

.tm-message-content {
    white-space: pre-wrap;
}



/* ============================================================
   TM01GPT — REVIEW / LEARNING
   ============================================================ */

.tm-review-panel {
    margin-top: 18px;
    padding: 18px;
    border: 1px solid var(--tm-border, #303846);
    border-radius: 12px;
    background: var(--tm-panel, #151a22);
}

.tm-review-panel[hidden] {
    display: none;
}


/* ------------------------------------------------------------
   CABEÇALHO
   ------------------------------------------------------------ */

.tm-review-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.tm-review-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.tm-review-subtitle {
    margin-top: 5px;
    font-size: 0.82rem;
    opacity: 0.65;
    line-height: 1.4;
}

.tm-review-status {
    flex-shrink: 0;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    background: var(--tm-bg, #10141b);
    opacity: 0.8;
}


/* ------------------------------------------------------------
   ITENS
   ------------------------------------------------------------ */

.tm-review-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tm-review-item {
    padding: 14px;
    border: 1px solid var(--tm-border, #303846);
    border-radius: 10px;
    background: var(--tm-bg, #10141b);
}

.tm-review-item-field {
    margin-bottom: 7px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.6;
}

.tm-review-item-original {
    font-size: 0.95rem;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.tm-review-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}


/* ------------------------------------------------------------
   BOTÕES DE ACÇÃO
   ------------------------------------------------------------ */

.tm-review-action {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--tm-border, #303846);
    border-radius: 8px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease;
}

.tm-review-action:hover {
    background: var(--tm-bg, #10141b);
    border-color: var(--tm-accent, #888);
}

.tm-review-action:active {
    transform: translateY(1px);
}


/* ------------------------------------------------------------
   CAMPO DE CORRECÇÃO
   ------------------------------------------------------------ */

.tm-review-correction {
    width: 100%;
    min-height: 70px;
    margin-top: 12px;
    padding: 10px 12px;
    box-sizing: border-box;

    border: 1px solid var(--tm-border, #303846);
    border-radius: 8px;

    background: var(--tm-bg, #10141b);
    color: inherit;

    font: inherit;
    font-size: 0.88rem;
    line-height: 1.4;

    resize: vertical;
}

.tm-review-correction:focus {
    outline: none;
    border-color: var(--tm-accent, #888);
}


/* ------------------------------------------------------------
   NOTA
   ------------------------------------------------------------ */

.tm-review-note {
    width: 100%;
    min-height: 50px;
    margin-top: 8px;
    padding: 9px 12px;
    box-sizing: border-box;

    border: 1px solid var(--tm-border, #303846);
    border-radius: 8px;

    background: var(--tm-bg, #10141b);
    color: inherit;

    font: inherit;
    font-size: 0.82rem;
    line-height: 1.4;

    resize: vertical;
}


/* ------------------------------------------------------------
   RODAPÉ
   ------------------------------------------------------------ */

.tm-review-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px solid var(--tm-border, #303846);
}

.tm-button-secondary {
    background: transparent;
    border: 1px solid var(--tm-border, #303846);
}

.tm-button-secondary:hover {
    background: var(--tm-bg, #10141b);
}


/* ------------------------------------------------------------
   ESTADOS
   ------------------------------------------------------------ */

.tm-review-item.is-correct {
    border-color: var(--tm-accent, #888);
}

.tm-review-item.is-incorrect,
.tm-review-item.is-partial {
    border-color: var(--tm-accent, #888);
}


/* ------------------------------------------------------------
   MOBILE
   ------------------------------------------------------------ */

@media (max-width: 600px) {

    .tm-review-panel {
        padding: 14px;
    }

    .tm-review-header {
        flex-direction: column;
        gap: 10px;
    }

    .tm-review-status {
        align-self: flex-start;
    }

    .tm-review-item-actions {
        flex-direction: column;
    }

    .tm-review-action {
        width: 100%;
    }

    .tm-review-footer {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .tm-review-footer .tm-button {
        width: 100%;
    }

}


/* ============================================================
   TM01GPT — ANÁLISE DE VÍDEO
   ============================================================ */

.tm-video-page {
    padding-bottom: 40px;
}

.tm-video-intro {
    margin-bottom: 28px;
}

.tm-video-source-card {
    margin-top: 0;
}

.tm-video-section-title {
    font-size: 16px;
    font-weight: 750;
}

.tm-video-source-tabs {
    display: flex;
    gap: 8px;
    margin-top: 18px;
    margin-bottom: 20px;
}

.tm-video-source-tab {
    min-height: 40px;
    padding: 0 15px;

    border: 1px solid var(--tm-border);
    border-radius: 9px;

    background: var(--tm-bg-2);
    color: var(--tm-muted);

    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
}

.tm-video-source-tab:hover {
    border-color: var(--tm-accent);
    color: var(--tm-text);
}

.tm-video-source-tab.is-active {
    background: rgba(232, 62, 140, .10);
    border-color: var(--tm-accent);
    color: var(--tm-text);
}

.tm-video-source-panel {
    width: 100%;
}

.tm-video-label {
    display: block;
    margin-bottom: 7px;

    color: var(--tm-muted);

    font-size: 12px;
    font-weight: 700;
}

.tm-video-url-input,
.tm-video-select,
.tm-video-file-input {
    width: 100%;
    min-height: 48px;

    padding: 11px 13px;

    border: 1px solid var(--tm-border);
    border-radius: 9px;

    background: var(--tm-bg);
    color: var(--tm-text);

    outline: none;
}

.tm-video-url-input:focus,
.tm-video-select:focus {
    border-color: var(--tm-accent);

    box-shadow:
        0 0 0 3px rgba(232, 62, 140, .10);
}

.tm-video-field-hint {
    margin-top: 7px;

    color: var(--tm-muted);

    font-size: 12px;
    line-height: 1.45;
}

.tm-video-options {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 14px;

    margin-top: 22px;
}

.tm-video-action {
    display: flex;
    justify-content: flex-end;

    margin-top: 24px;
    padding-top: 18px;

    border-top: 1px solid var(--tm-border);
}

.tm-video-processing {
    margin-top: 18px;
}

.tm-video-status {
    margin-top: 12px;

    font-size: 14px;
    font-weight: 650;
}

.tm-video-status-detail {
    margin-top: 8px;

    color: var(--tm-muted);
    font-size: 12px;
}

.tm-video-progress {
    height: 7px;

    margin-top: 18px;

    overflow: hidden;

    border-radius: 10px;

    background: var(--tm-bg);
}

.tm-video-progress-bar {
    width: 0;
    height: 100%;

    border-radius: inherit;

    background: var(--tm-accent);

    transition: width .3s ease;
}

.tm-video-error {
    margin-top: 18px;

    border-color: #71364f;
}

.tm-video-error-message {
    margin-top: 10px;

    color: var(--tm-soft);

    white-space: pre-wrap;
}

.tm-video-result {
    display: flex;
    flex-direction: column;
    gap: 18px;

    margin-top: 18px;
}

.tm-video-filename {
    margin-top: 10px;

    font-size: 18px;
    font-weight: 700;
}

.tm-video-source {
    margin-top: 4px;

    color: var(--tm-muted);

    font-size: 12px;

    overflow-wrap: anywhere;
}

.tm-video-info-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 10px;

    margin-top: 16px;
}

.tm-video-info-item {
    padding: 13px;

    border: 1px solid var(--tm-border);
    border-radius: 9px;

    background: var(--tm-bg);
}

.tm-video-info-label {
    color: var(--tm-muted);

    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.tm-video-info-value {
    margin-top: 4px;

    font-size: 14px;
    font-weight: 650;

    overflow-wrap: anywhere;
}

.tm-video-section-header {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.tm-video-transcript {
    max-height: 600px;

    margin-top: 16px;
    padding: 15px;

    overflow-y: auto;

    border: 1px solid var(--tm-border);
    border-radius: 10px;

    background: var(--tm-bg);

    font-size: 14px;
    line-height: 1.65;
}

.tm-video-transcript-segment {
    display: grid;
    grid-template-columns: 90px 1fr;

    gap: 12px;

    padding: 9px 0;

    border-bottom: 1px solid rgba(37, 45, 57, .65);
}

.tm-video-transcript-segment:last-child {
    border-bottom: 0;
}

.tm-video-transcript-time {
    color: var(--tm-accent);

    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.tm-video-analysis-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 14px;

    margin-top: 18px;
}

.tm-video-analysis-block {
    padding: 15px;

    border: 1px solid var(--tm-border);
    border-radius: 10px;

    background: var(--tm-bg);
}

.tm-video-analysis-block:first-child,
.tm-video-analysis-block:last-child {
    grid-column: 1 / -1;
}

.tm-video-analysis-label {
    margin-bottom: 9px;

    color: var(--tm-muted);

    font-size: 11px;
    font-weight: 750;

    letter-spacing: .07em;
    text-transform: uppercase;
}

.tm-video-analysis-value {
    color: var(--tm-text);

    font-size: 14px;
    line-height: 1.6;

    white-space: pre-wrap;
}

.tm-video-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.tm-video-tag {
    display: inline-flex;
    align-items: center;

    min-height: 29px;
    padding: 0 9px;

    border: 1px solid var(--tm-border);
    border-radius: 999px;

    background: var(--tm-panel-2);

    color: var(--tm-soft);

    font-size: 12px;
}

.tm-video-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tm-video-list-item {
    padding: 9px 11px;

    border-left: 2px solid var(--tm-accent);

    background: var(--tm-panel-2);

    font-size: 13px;
    line-height: 1.5;
}


@media (max-width: 700px) {

    .tm-video-source-tabs {
        width: 100%;
    }

    .tm-video-source-tab {
        flex: 1;
    }

    .tm-video-options {
        grid-template-columns: 1fr;
    }

    .tm-video-action {
        justify-content: stretch;
    }

    .tm-video-action .tm-button {
        width: 100%;
    }

    .tm-video-info-grid {
        grid-template-columns: 1fr 1fr;
    }

    .tm-video-analysis-grid {
        grid-template-columns: 1fr;
    }

    .tm-video-analysis-block:first-child,
    .tm-video-analysis-block:last-child {
        grid-column: auto;
    }

    .tm-video-transcript-segment {
        grid-template-columns: 1fr;
        gap: 3px;
    }

}


@media (max-width: 380px) {

    .tm-video-info-grid {
        grid-template-columns: 1fr;
    }

}


/* ============================================================
   TM01GPT — ANÁLISE DE VÍDEO
   ============================================================ */

.tm-video-page {
    padding-bottom: 40px;
}

.tm-video-intro {
    margin-bottom: 28px;
}

.tm-video-source-card {
    margin-top: 0;
}

.tm-video-section-title {
    font-size: 16px;
    font-weight: 750;
}

.tm-video-source-tabs {
    display: flex;
    gap: 8px;
    margin-top: 18px;
    margin-bottom: 20px;
}

.tm-video-source-tab {
    min-height: 40px;
    padding: 0 15px;

    border: 1px solid var(--tm-border);
    border-radius: 9px;

    background: var(--tm-bg-2);
    color: var(--tm-muted);

    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
}

.tm-video-source-tab:hover {
    border-color: var(--tm-accent);
    color: var(--tm-text);
}

.tm-video-source-tab.is-active {
    background: rgba(232, 62, 140, .10);
    border-color: var(--tm-accent);
    color: var(--tm-text);
}

.tm-video-source-panel {
    width: 100%;
}

.tm-video-label {
    display: block;
    margin-bottom: 7px;

    color: var(--tm-muted);

    font-size: 12px;
    font-weight: 700;
}

.tm-video-url-input,
.tm-video-select,
.tm-video-file-input {
    width: 100%;
    min-height: 48px;

    padding: 11px 13px;

    border: 1px solid var(--tm-border);
    border-radius: 9px;

    background: var(--tm-bg);
    color: var(--tm-text);

    outline: none;
}

.tm-video-url-input:focus,
.tm-video-select:focus {
    border-color: var(--tm-accent);

    box-shadow:
        0 0 0 3px rgba(232, 62, 140, .10);
}

.tm-video-field-hint {
    margin-top: 7px;

    color: var(--tm-muted);

    font-size: 12px;
    line-height: 1.45;
}

.tm-video-options {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 14px;

    margin-top: 22px;
}

.tm-video-action {
    display: flex;
    justify-content: flex-end;

    margin-top: 24px;
    padding-top: 18px;

    border-top: 1px solid var(--tm-border);
}

.tm-video-processing {
    margin-top: 18px;
}

.tm-video-status {
    margin-top: 12px;

    font-size: 14px;
    font-weight: 650;
}

.tm-video-status-detail {
    margin-top: 8px;

    color: var(--tm-muted);
    font-size: 12px;
}

.tm-video-progress {
    height: 7px;

    margin-top: 18px;

    overflow: hidden;

    border-radius: 10px;

    background: var(--tm-bg);
}

.tm-video-progress-bar {
    width: 0;
    height: 100%;

    border-radius: inherit;

    background: var(--tm-accent);

    transition: width .3s ease;
}

.tm-video-error {
    margin-top: 18px;

    border-color: #71364f;
}

.tm-video-error-message {
    margin-top: 10px;

    color: var(--tm-soft);

    white-space: pre-wrap;
}

.tm-video-result {
    display: flex;
    flex-direction: column;
    gap: 18px;

    margin-top: 18px;
}

.tm-video-filename {
    margin-top: 10px;

    font-size: 18px;
    font-weight: 700;
}

.tm-video-source {
    margin-top: 4px;

    color: var(--tm-muted);

    font-size: 12px;

    overflow-wrap: anywhere;
}

.tm-video-info-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 10px;

    margin-top: 16px;
}

.tm-video-info-item {
    padding: 13px;

    border: 1px solid var(--tm-border);
    border-radius: 9px;

    background: var(--tm-bg);
}

.tm-video-info-label {
    color: var(--tm-muted);

    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.tm-video-info-value {
    margin-top: 4px;

    font-size: 14px;
    font-weight: 650;

    overflow-wrap: anywhere;
}

.tm-video-section-header {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.tm-video-transcript {
    max-height: 600px;

    margin-top: 16px;
    padding: 15px;

    overflow-y: auto;

    border: 1px solid var(--tm-border);
    border-radius: 10px;

    background: var(--tm-bg);

    font-size: 14px;
    line-height: 1.65;
}

.tm-video-transcript-segment {
    display: grid;
    grid-template-columns: 90px 1fr;

    gap: 12px;

    padding: 9px 0;

    border-bottom: 1px solid rgba(37, 45, 57, .65);
}

.tm-video-transcript-segment:last-child {
    border-bottom: 0;
}

.tm-video-transcript-time {
    color: var(--tm-accent);

    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.tm-video-analysis-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 14px;

    margin-top: 18px;
}

.tm-video-analysis-block {
    padding: 15px;

    border: 1px solid var(--tm-border);
    border-radius: 10px;

    background: var(--tm-bg);
}

.tm-video-analysis-block:first-child,
.tm-video-analysis-block:last-child {
    grid-column: 1 / -1;
}

.tm-video-analysis-label {
    margin-bottom: 9px;

    color: var(--tm-muted);

    font-size: 11px;
    font-weight: 750;

    letter-spacing: .07em;
    text-transform: uppercase;
}

.tm-video-analysis-value {
    color: var(--tm-text);

    font-size: 14px;
    line-height: 1.6;

    white-space: pre-wrap;
}

.tm-video-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.tm-video-tag {
    display: inline-flex;
    align-items: center;

    min-height: 29px;
    padding: 0 9px;

    border: 1px solid var(--tm-border);
    border-radius: 999px;

    background: var(--tm-panel-2);

    color: var(--tm-soft);

    font-size: 12px;
}

.tm-video-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tm-video-list-item {
    padding: 9px 11px;

    border-left: 2px solid var(--tm-accent);

    background: var(--tm-panel-2);

    font-size: 13px;
    line-height: 1.5;
}


@media (max-width: 700px) {

    .tm-video-source-tabs {
        width: 100%;
    }

    .tm-video-source-tab {
        flex: 1;
    }

    .tm-video-options {
        grid-template-columns: 1fr;
    }

    .tm-video-action {
        justify-content: stretch;
    }

    .tm-video-action .tm-button {
        width: 100%;
    }

    .tm-video-info-grid {
        grid-template-columns: 1fr 1fr;
    }

    .tm-video-analysis-grid {
        grid-template-columns: 1fr;
    }

    .tm-video-analysis-block:first-child,
    .tm-video-analysis-block:last-child {
        grid-column: auto;
    }

    .tm-video-transcript-segment {
        grid-template-columns: 1fr;
        gap: 3px;
    }

}


@media (max-width: 380px) {

    .tm-video-info-grid {
        grid-template-columns: 1fr;
    }

}


/* ============================================================
   TM01GPT — ANÁLISE DE VÍDEO
   ============================================================ */

.tm-video-page {
    padding-bottom: 40px;
}

.tm-video-intro {
    margin-bottom: 28px;
}

.tm-video-source-card {
    margin-top: 0;
}

.tm-video-section-title {
    font-size: 16px;
    font-weight: 750;
}

.tm-video-source-tabs {
    display: flex;
    gap: 8px;
    margin-top: 18px;
    margin-bottom: 20px;
}

.tm-video-source-tab {
    min-height: 40px;
    padding: 0 15px;

    border: 1px solid var(--tm-border);
    border-radius: 9px;

    background: var(--tm-bg-2);
    color: var(--tm-muted);

    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
}

.tm-video-source-tab:hover {
    border-color: var(--tm-accent);
    color: var(--tm-text);
}

.tm-video-source-tab.is-active {
    background: rgba(232, 62, 140, .10);
    border-color: var(--tm-accent);
    color: var(--tm-text);
}

.tm-video-source-panel {
    width: 100%;
}

.tm-video-label {
    display: block;
    margin-bottom: 7px;

    color: var(--tm-muted);

    font-size: 12px;
    font-weight: 700;
}

.tm-video-url-input,
.tm-video-select,
.tm-video-file-input {
    width: 100%;
    min-height: 48px;

    padding: 11px 13px;

    border: 1px solid var(--tm-border);
    border-radius: 9px;

    background: var(--tm-bg);
    color: var(--tm-text);

    outline: none;
}

.tm-video-url-input:focus,
.tm-video-select:focus {
    border-color: var(--tm-accent);

    box-shadow:
        0 0 0 3px rgba(232, 62, 140, .10);
}

.tm-video-field-hint {
    margin-top: 7px;

    color: var(--tm-muted);

    font-size: 12px;
    line-height: 1.45;
}

.tm-video-options {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 14px;

    margin-top: 22px;
}

.tm-video-action {
    display: flex;
    justify-content: flex-end;

    margin-top: 24px;
    padding-top: 18px;

    border-top: 1px solid var(--tm-border);
}

.tm-video-processing {
    margin-top: 18px;
}

.tm-video-status {
    margin-top: 12px;

    font-size: 14px;
    font-weight: 650;
}

.tm-video-status-detail {
    margin-top: 8px;

    color: var(--tm-muted);
    font-size: 12px;
}

.tm-video-progress {
    height: 7px;

    margin-top: 18px;

    overflow: hidden;

    border-radius: 10px;

    background: var(--tm-bg);
}

.tm-video-progress-bar {
    width: 0;
    height: 100%;

    border-radius: inherit;

    background: var(--tm-accent);

    transition: width .3s ease;
}

.tm-video-error {
    margin-top: 18px;

    border-color: #71364f;
}

.tm-video-error-message {
    margin-top: 10px;

    color: var(--tm-soft);

    white-space: pre-wrap;
}

.tm-video-result {
    display: flex;
    flex-direction: column;
    gap: 18px;

    margin-top: 18px;
}

.tm-video-filename {
    margin-top: 10px;

    font-size: 18px;
    font-weight: 700;
}

.tm-video-source {
    margin-top: 4px;

    color: var(--tm-muted);

    font-size: 12px;

    overflow-wrap: anywhere;
}

.tm-video-info-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 10px;

    margin-top: 16px;
}

.tm-video-info-item {
    padding: 13px;

    border: 1px solid var(--tm-border);
    border-radius: 9px;

    background: var(--tm-bg);
}

.tm-video-info-label {
    color: var(--tm-muted);

    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.tm-video-info-value {
    margin-top: 4px;

    font-size: 14px;
    font-weight: 650;

    overflow-wrap: anywhere;
}

.tm-video-section-header {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.tm-video-transcript {
    max-height: 600px;

    margin-top: 16px;
    padding: 15px;

    overflow-y: auto;

    border: 1px solid var(--tm-border);
    border-radius: 10px;

    background: var(--tm-bg);

    font-size: 14px;
    line-height: 1.65;
}

.tm-video-transcript-segment {
    display: grid;
    grid-template-columns: 90px 1fr;

    gap: 12px;

    padding: 9px 0;

    border-bottom: 1px solid rgba(37, 45, 57, .65);
}

.tm-video-transcript-segment:last-child {
    border-bottom: 0;
}

.tm-video-transcript-time {
    color: var(--tm-accent);

    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.tm-video-analysis-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 14px;

    margin-top: 18px;
}

.tm-video-analysis-block {
    padding: 15px;

    border: 1px solid var(--tm-border);
    border-radius: 10px;

    background: var(--tm-bg);
}

.tm-video-analysis-block:first-child,
.tm-video-analysis-block:last-child {
    grid-column: 1 / -1;
}

.tm-video-analysis-label {
    margin-bottom: 9px;

    color: var(--tm-muted);

    font-size: 11px;
    font-weight: 750;

    letter-spacing: .07em;
    text-transform: uppercase;
}

.tm-video-analysis-value {
    color: var(--tm-text);

    font-size: 14px;
    line-height: 1.6;

    white-space: pre-wrap;
}

.tm-video-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.tm-video-tag {
    display: inline-flex;
    align-items: center;

    min-height: 29px;
    padding: 0 9px;

    border: 1px solid var(--tm-border);
    border-radius: 999px;

    background: var(--tm-panel-2);

    color: var(--tm-soft);

    font-size: 12px;
}

.tm-video-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tm-video-list-item {
    padding: 9px 11px;

    border-left: 2px solid var(--tm-accent);

    background: var(--tm-panel-2);

    font-size: 13px;
    line-height: 1.5;
}


@media (max-width: 700px) {

    .tm-video-source-tabs {
        width: 100%;
    }

    .tm-video-source-tab {
        flex: 1;
    }

    .tm-video-options {
        grid-template-columns: 1fr;
    }

    .tm-video-action {
        justify-content: stretch;
    }

    .tm-video-action .tm-button {
        width: 100%;
    }

    .tm-video-info-grid {
        grid-template-columns: 1fr 1fr;
    }

    .tm-video-analysis-grid {
        grid-template-columns: 1fr;
    }

    .tm-video-analysis-block:first-child,
    .tm-video-analysis-block:last-child {
        grid-column: auto;
    }

    .tm-video-transcript-segment {
        grid-template-columns: 1fr;
        gap: 3px;
    }

}


@media (max-width: 380px) {

    .tm-video-info-grid {
        grid-template-columns: 1fr;
    }

}


/* ============================================================
   TM01GPT — BROWSER TABS
   ============================================================ */


.tm-header {

    flex-wrap: wrap;

}


.tm-tabs {

    display:flex;

    align-items:center;

    gap:6px;

    width:100%;

    overflow-x:auto;

    scrollbar-width:none;

}


.tm-tabs::-webkit-scrollbar {

    display:none;

}



.tm-tab {

    display:flex;

    align-items:center;

    justify-content:center;


    min-height:36px;

    padding:0 14px;


    border-radius:9px;


    border:1px solid transparent;


    color:var(--tm-muted);


    font-size:13px;


    white-space:nowrap;


    transition:.2s ease;

}



.tm-tab:hover {

    background:var(--tm-panel);

    color:var(--tm-text);

}



.tm-tab-active {

    background:var(--tm-panel-2);

    border-color:var(--tm-border);

    color:white;

}


/* ============================================================
   TM01GPT — CABEÇALHO UNIFICADO / TABS
   ============================================================ */

.tm-header {
    display: flex;
    align-items: center;
    gap: 20px;
}

.tm-header-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 1;
}

.tm-header-actions .tm-button {
    white-space: nowrap;
}

#tm-nav {
    flex: 0 0 auto;
}

.tm-tabs {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    white-space: nowrap;
}

.tm-tab {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 8px;

    color: var(--tm-soft);

    font-size: 14px;
    font-weight: 500;

    border-radius: 8px;

    transition:
        background .18s ease,
        color .18s ease;
}

.tm-tab:hover {
    background: var(--tm-panel-2);
    color: var(--tm-text);
}

.tm-tab-active {
    background: var(--tm-panel-2);
    color: var(--tm-text);
}

@media (max-width: 1100px) {

    .tm-header {
        flex-wrap: wrap;
    }

    .tm-header-actions {
        flex: 0 0 auto;
        margin-left: auto;
    }

    #tm-nav {
        width: 100%;
        order: 3;
    }

    .tm-tabs {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 4px;
    }
}

@media (max-width: 700px) {

    .tm-header-actions {
        display: none;
    }

    .tm-tabs {
        width: 100%;
        overflow-x: auto;
    }

    .tm-tab {
        flex: 0 0 auto;
        font-size: 13px;
        padding: 0 7px;
    }
}


/* ============================================================
   TM01GPT — CABEÇALHO UNIFICADO / TABS
   ============================================================ */

.tm-header {
    display: flex;
    align-items: center;
    gap: 20px;
}

.tm-header-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 1;
}

.tm-header-actions .tm-button {
    white-space: nowrap;
}

#tm-nav {
    flex: 0 0 auto;
}

.tm-tabs {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    white-space: nowrap;
}

.tm-tab {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 8px;

    color: var(--tm-soft);

    font-size: 14px;
    font-weight: 500;

    border-radius: 8px;

    transition:
        background .18s ease,
        color .18s ease;
}

.tm-tab:hover {
    background: var(--tm-panel-2);
    color: var(--tm-text);
}

.tm-tab-active {
    background: var(--tm-panel-2);
    color: var(--tm-text);
}

@media (max-width: 1100px) {

    .tm-header {
        flex-wrap: wrap;
    }

    .tm-header-actions {
        flex: 0 0 auto;
        margin-left: auto;
    }

    #tm-nav {
        width: 100%;
        order: 3;
    }

    .tm-tabs {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 4px;
    }
}

@media (max-width: 700px) {

    .tm-header-actions {
        display: none;
    }

    .tm-tabs {
        width: 100%;
        overflow-x: auto;
    }

    .tm-tab {
        flex: 0 0 auto;
        font-size: 13px;
        padding: 0 7px;
    }
}



/* =====================================================
   TM01GPT DASHBOARD
   ===================================================== */


.tm-header-actions {

display:flex;

gap:10px;

flex-wrap:wrap;

}



.tm-dashboard-grid {

display:grid;

grid-template-columns:
repeat(auto-fit,minmax(220px,1fr));

gap:20px;

margin-top:20px;

}



.tm-dashboard-item {

background:rgba(255,255,255,0.03);

border:1px solid rgba(255,255,255,0.08);

border-radius:14px;

padding:20px;

}



.tm-dashboard-item h3 {

margin-top:0;

margin-bottom:10px;

}



.tm-topic-list {

display:grid;

gap:12px;

}



.tm-topic-list div {

padding:16px;

background:rgba(255,255,255,0.03);

border-radius:12px;

border:1px solid rgba(255,255,255,0.08);

}



.tm-job-list {

display:grid;

gap:12px;

}



.tm-job {

display:flex;

justify-content:space-between;

align-items:center;

padding:16px;

background:rgba(255,255,255,0.03);

border-radius:12px;

border:1px solid rgba(255,255,255,0.08);

}



.tm-status-success {

color:#40e58c;

}



.tm-tools-grid {

display:grid;

grid-template-columns:
repeat(auto-fit,minmax(180px,1fr));

gap:15px;

}



.tm-tools-grid div {

padding:18px;

background:rgba(255,255,255,0.03);

border-radius:12px;

text-align:center;

border:1px solid rgba(255,255,255,0.08);

}



/* ============================================================
   CHAT — ALTURA FIXA AO ECRÃ
   Caixa de escrita sempre visível
   ============================================================ */

html,
body {
    height: 100%;
}

body {
    overflow-y: hidden;
}

.tm-main {
    height: calc(100dvh - var(--tm-header-height));
    min-height: 0;

    padding:
        20px
        clamp(10px, 4vw, 24px)
        20px;

    overflow: hidden;
}

.tm-container {
    height: 100%;
    min-height: 0;
}

.tm-chat {
    height: 100%;
    min-height: 0;
    max-height: 100%;

    display: flex;
    flex-direction: column;

    overflow: hidden;
}

.tm-chat-header,
.tm-coder-controls,
.tm-review-panel,
.tm-chat-form {
    flex-shrink: 0;
}

.tm-messages {
    flex: 1 1 auto;

    min-height: 0;
    height: auto;

    overflow-y: auto;
    overflow-x: hidden;
}


/* TABLET */

@media (max-width: 1024px) {

    .tm-chat {
        height: 100%;
        min-height: 0;
    }

    .tm-messages {
        min-height: 0;
    }
}


/* SMARTPHONE */

@media (max-width: 700px) {

    .tm-main {
        height: calc(100dvh - var(--tm-header-height));
        min-height: 0;

        padding: 8px;
    }

    .tm-chat {
        height: 100%;
        min-height: 0;
    }

    .tm-messages {
        min-height: 0;
    }
}


/* Scroll exclusivo da janela de conversa */
.tm-messages {
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    min-height: 0;
}

html,
body {
    overflow: hidden;
}



/* ============================================================
   TM01GPT — EXPLORADOR DE RECURSOS
   ============================================================ */

.tm-resource-explorer {
    flex-shrink: 0;
    margin: 10px 0;

    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 12px;

    background: var(--tm-panel);
}

.tm-resource-summary {
    cursor: pointer;

    padding: 12px 14px;

    font-weight: 700;

    user-select: none;
}

.tm-resource-explorer[open]
.tm-resource-summary {
    border-bottom:
        1px solid rgba(255,255,255,0.08);
}

.tm-resource-toolbar,
.tm-resource-actions,
.tm-resource-job-controls {
    display: flex;
    gap: 8px;

    flex-wrap: wrap;
    align-items: center;

    padding: 10px 12px;
}

.tm-resource-node-status {
    margin-left: auto;

    font-size: 0.85rem;
    opacity: 0.8;
}

.tm-resource-path-row {
    display: flex;

    gap: 10px;
    align-items: center;

    padding: 8px 12px;

    font-size: 0.85rem;
}

.tm-resource-path-row code,
.tm-resource-selected code {
    overflow-wrap: anywhere;
}

.tm-resource-entries {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(180px, 1fr)
        );

    gap: 6px;

    max-height: 260px;
    overflow-y: auto;

    padding: 10px 12px;

    border-top:
        1px solid rgba(255,255,255,0.06);

    border-bottom:
        1px solid rgba(255,255,255,0.06);
}

.tm-resource-entry {
    appearance: none;

    display: flex;

    align-items: center;
    gap: 8px;

    min-width: 0;

    padding: 10px;

    border:
        1px solid rgba(255,255,255,0.08);

    border-radius: 9px;

    background:
        rgba(255,255,255,0.025);

    color: inherit;

    text-align: left;

    cursor: pointer;
}

.tm-resource-entry:hover {
    background:
        rgba(255,255,255,0.07);
}

.tm-resource-entry.is-selected {
    outline:
        2px solid currentColor;

    outline-offset: -2px;
}

.tm-resource-entry-icon {
    flex-shrink: 0;
}

.tm-resource-entry-name {
    overflow: hidden;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.tm-resource-selected {
    padding: 10px 12px;
}

.tm-resource-selected-label {
    margin-bottom: 5px;

    font-size: 0.75rem;
    opacity: 0.65;

    text-transform: uppercase;
}

.tm-resource-selected-type {
    margin-top: 4px;

    font-size: 0.8rem;
    opacity: 0.7;
}

.tm-resource-job-controls label {
    display: flex;

    align-items: center;
    gap: 7px;

    font-size: 0.85rem;
}

.tm-resource-result {
    padding: 10px 12px;

    border-top:
        1px solid rgba(255,255,255,0.06);

    font-size: 0.85rem;

    overflow-wrap: anywhere;
}

.tm-resource-empty {
    padding: 15px;

    opacity: 0.7;
}


@media (max-width: 700px) {

    .tm-resource-entries {
        grid-template-columns:
            1fr;

        max-height: 210px;
    }

    .tm-resource-node-status {
        width: 100%;
        margin-left: 0;
    }

    .tm-resource-actions
    .tm-button {
        flex: 1 1 auto;
    }
}



/* ============================================================
   TM01GPT — LAYOUT PRODUÇÃO CHAT / RECURSOS
   ============================================================ */

.tm-chat {

    display: grid;

    grid-template-columns:
        minmax(290px, 340px)
        minmax(0, 1fr);

    grid-template-rows:
        auto
        auto
        auto
        minmax(0, 1fr)
        auto;

    grid-template-areas:
        "header   header"
        "coder    coder"
        "explorer composer"
        "explorer messages"
        "review   review";

    column-gap: 16px;

    height: 100%;
    min-height: 0;

    overflow: hidden;
}


/* ------------------------------------------------------------
   HEADER
   ------------------------------------------------------------ */

.tm-chat-header {

    grid-area: header;

    margin-bottom: 14px;
}


/* ------------------------------------------------------------
   CODER
   ------------------------------------------------------------ */

.tm-coder-controls {

    grid-area: coder;

    margin-bottom: 14px;
}


/* ------------------------------------------------------------
   EXPLORADOR — COLUNA ESQUERDA
   ------------------------------------------------------------ */

.tm-resource-explorer {

    grid-area: explorer;

    margin: 0;

    min-width: 0;
    min-height: 0;

    height: 100%;

    align-self: stretch;

    overflow: hidden;

    border-radius: 14px;
}


.tm-resource-explorer[open] {

    display: flex;

    flex-direction: column;

    min-height: 0;
}


.tm-resource-summary {

    flex: 0 0 auto;

    padding: 14px 16px;

    font-size: 0.95rem;
}


.tm-resource-toolbar {

    flex: 0 0 auto;

    padding:
        10px
        12px;
}


.tm-resource-node-status {

    width: 100%;

    margin: 4px 0 0;

    padding: 7px 9px;

    border-radius: 8px;

    background:
        rgba(255,255,255,0.035);

    font-size: 0.78rem;
}


.tm-resource-path-row {

    flex: 0 0 auto;

    display: block;

    padding:
        10px
        12px;
}


.tm-resource-path-row > span {

    display: block;

    margin-bottom: 5px;

    font-size: 0.7rem;

    text-transform: uppercase;

    opacity: 0.55;
}


.tm-resource-path-row code {

    display: block;

    padding: 8px;

    border-radius: 7px;

    background:
        rgba(0,0,0,0.20);

    font-size: 0.78rem;

    line-height: 1.35;
}


/* lista de ficheiros passa a ocupar o espaço disponível */

.tm-resource-entries {

    flex: 1 1 auto;

    min-height: 120px;

    max-height: none;

    overflow-y: auto;

    grid-template-columns: 1fr;

    align-content: start;

    padding:
        8px
        10px;
}


.tm-resource-entry {

    width: 100%;

    min-height: 38px;

    padding:
        8px
        9px;
}


.tm-resource-entry-name {

    font-size: 0.83rem;
}


/* ------------------------------------------------------------
   SELEÇÃO
   ------------------------------------------------------------ */

.tm-resource-selected {

    flex: 0 0 auto;

    padding:
        10px
        12px;
}


.tm-resource-selected code {

    display: block;

    max-height: 55px;

    overflow: auto;

    padding: 7px;

    border-radius: 7px;

    background:
        rgba(0,0,0,0.20);

    font-size: 0.75rem;
}


/* ------------------------------------------------------------
   JOB
   ------------------------------------------------------------ */

.tm-resource-job-controls {

    flex: 0 0 auto;

    display: grid;

    grid-template-columns:
        1fr
        1fr;

    gap: 8px;

    padding:
        8px
        12px;
}


.tm-resource-job-controls label {

    display: grid;

    gap: 5px;

    align-items: initial;

    font-size: 0.72rem;

    opacity: 0.9;
}


.tm-resource-job-controls
.tm-mode-select {

    width: 100%;
}


/* ------------------------------------------------------------
   BOTÕES DO EXPLORADOR
   ------------------------------------------------------------ */

.tm-resource-actions {

    flex: 0 0 auto;

    display: grid;

    grid-template-columns:
        1fr
        1fr;

    gap: 7px;

    padding:
        8px
        12px
        10px;
}


.tm-resource-actions
.tm-button {

    width: 100%;

    min-width: 0;

    padding:
        8px
        7px;

    font-size: 0.76rem;
}


.tm-resource-result {

    flex: 0 0 auto;

    max-height: 72px;

    overflow-y: auto;

    padding:
        9px
        12px;

    font-size: 0.76rem;
}


/* ============================================================
   COMPOSITOR — COLUNA DIREITA
   ============================================================ */

.tm-chat-form {

    grid-area: composer;

    display: grid;

    grid-template-columns: 1fr;

    gap: 8px;

    min-width: 0;

    margin: 0 0 12px;

    padding: 0;
}


.tm-chat-input {

    width: 100%;

    min-height: 88px;

    max-height: 180px;

    resize: vertical;
}


.tm-chat-form-footer {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 12px;
}


.tm-chat-hint {

    font-size: 0.78rem;

    opacity: 0.60;
}


/* ============================================================
   CONVERSA — COLUNA DIREITA
   ============================================================ */

.tm-messages {

    grid-area: messages;

    min-width: 0;
    min-height: 0;

    height: auto;

    overflow-y: auto;
    overflow-x: hidden;

    padding:
        2px
        4px
        20px;

    border-top:
        1px solid rgba(255,255,255,0.05);
}


/* mensagens passam a aproveitar melhor a largura */

.tm-message {

    max-width: 92%;
}


.tm-message-user {

    margin-left: auto;
}


.tm-message-assistant {

    margin-right: auto;
}


/* ============================================================
   REVIEW
   ============================================================ */

.tm-review-panel {

    grid-area: review;
}


/* ============================================================
   DESKTOP GRANDE
   ============================================================ */

@media (min-width: 1500px) {

    .tm-chat {

        grid-template-columns:
            360px
            minmax(0, 1fr);

        column-gap: 20px;
    }

}


/* ============================================================
   TABLET
   ============================================================ */

@media (max-width: 1050px) {

    .tm-chat {

        grid-template-columns:
            270px
            minmax(0, 1fr);

        column-gap: 12px;
    }

}


/* ============================================================
   TABLET PEQUENO / SMARTPHONE
   ============================================================ */

@media (max-width: 800px) {

    .tm-chat {

        display: flex;

        flex-direction: column;

        height: 100%;

        overflow: hidden;
    }


    .tm-chat-header {

        flex: 0 0 auto;

        margin-bottom: 8px;
    }


    .tm-coder-controls {

        flex: 0 0 auto;

        margin-bottom: 8px;
    }


    .tm-resource-explorer {

        flex: 0 0 auto;

        height: auto;

        max-height: 42vh;

        margin-bottom: 8px;
    }


    .tm-resource-explorer[open] {

        display: block;

        overflow-y: auto;
    }


    .tm-resource-entries {

        max-height: 180px;
    }


    .tm-chat-form {

        flex: 0 0 auto;

        margin-bottom: 8px;
    }


    .tm-messages {

        flex: 1 1 auto;

        min-height: 0;
    }

}


/* ============================================================
   SMARTPHONE
   ============================================================ */

@media (max-width: 520px) {

    .tm-resource-job-controls {

        grid-template-columns:
            1fr;
    }


    .tm-resource-actions {

        grid-template-columns:
            1fr;
    }


    .tm-chat-form-footer {

        align-items: stretch;

        flex-direction: column;
    }


    .tm-chat-form-footer
    .tm-button {

        width: 100%;
    }


    .tm-message {

        max-width: 100%;
    }

}



/* ============================================================
   TM01GPT WORKSTATION — CHAT V2
   ============================================================ */

.tm-chat-page {
    padding: 18px;
    height:
        calc(
            100dvh -
            var(--tm-header-height)
        );

    overflow: hidden;
}


.tm-chat-shell {
    width: min(
        1500px,
        100%
    );

    height: 100%;

    margin: 0 auto;

    display: flex;
    flex-direction: column;

    min-height: 0;

    border:
        1px solid
        rgba(255,255,255,.08);

    border-radius: 18px;

    background:
        #0c1119;

    overflow: hidden;

    box-shadow:
        0 20px 60px
        rgba(0,0,0,.18);
}


/* ============================================================
   HEADER
   ============================================================ */

.tm-workstation-header {
    flex: 0 0 auto;

    min-height: 84px;

    padding:
        18px
        22px;

    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 20px;

    border-bottom:
        1px solid
        rgba(255,255,255,.08);

    background:
        #141b26;
}


.tm-workstation-title {
    font-size: 1.1rem;
    font-weight: 750;
}


.tm-workstation-status {
    display: flex;
    align-items: center;

    gap: 7px;

    margin-top: 5px;

    font-size: .76rem;

    opacity: .65;
}


.tm-status-dot {
    width: 8px;
    height: 8px;

    border-radius: 50%;

    background: #42df93;

    box-shadow:
        0 0 10px
        rgba(66,223,147,.7);
}


.tm-workstation-mode {
    display: flex;
    align-items: center;

    gap: 10px;
}


.tm-workstation-mode label {
    font-size: .78rem;
    opacity: .6;
}


.tm-mode-status {
    min-width: 155px;

    font-size: .8rem;

    opacity: .7;
}


/* ============================================================
   CODER BAR
   ============================================================ */

.tm-coder-bar {
    flex: 0 0 auto;

    padding:
        10px
        18px;

    display: flex;

    align-items: end;

    gap: 12px;

    border-bottom:
        1px solid
        rgba(255,255,255,.07);

    background:
        #101721;
}


.tm-coder-bar[hidden] {
    display: none;
}


.tm-coder-field {
    display: grid;
    gap: 5px;
}


.tm-coder-field label {
    font-size: .7rem;
    opacity: .6;
}


.tm-coder-status {
    margin-left: auto;

    padding-bottom: 9px;

    font-size: .78rem;
    opacity: .65;
}


/* ============================================================
   ÁREA CENTRAL
   ============================================================ */

.tm-ai-workspace {
    flex: 1 1 auto;

    min-height: 0;

    display: grid;

    grid-template-columns:
        320px
        minmax(0, 1fr);
}


/* ============================================================
   SIDEBAR
   ============================================================ */

.tm-resource-sidebar {
    min-width: 0;
    min-height: 0;

    display: flex;
    flex-direction: column;

    border-right:
        1px solid
        rgba(255,255,255,.08);

    background:
        #0f151e;
}


.tm-resource-sidebar-header {
    flex: 0 0 auto;

    padding:
        17px
        16px
        13px;
}


.tm-sidebar-title {
    font-size: .95rem;
    font-weight: 700;
}


.tm-sidebar-subtitle {
    margin-top: 3px;

    font-size: .72rem;
    opacity: .48;
}


/* ============================================================
   TABS
   ============================================================ */

.tm-resource-tabs {
    flex: 0 0 auto;

    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    padding:
        0
        10px
        10px;

    gap: 5px;

    border-bottom:
        1px solid
        rgba(255,255,255,.06);
}


.tm-resource-tab {
    appearance: none;

    border:
        1px solid
        transparent;

    border-radius: 8px;

    background:
        transparent;

    color: inherit;

    padding:
        8px
        5px;

    font-size: .72rem;

    cursor: pointer;
}


.tm-resource-tab:hover {
    background:
        rgba(255,255,255,.05);
}


.tm-resource-tab.is-active {
    background:
        rgba(255,255,255,.07);

    border-color:
        rgba(255,255,255,.08);
}


.tm-resource-tab-panel {
    display: none;

    flex: 1 1 auto;

    min-height: 0;
}


.tm-resource-tab-panel.is-active {
    display: flex;
    flex-direction: column;
}


/* ============================================================
   FILE EXPLORER
   ============================================================ */

.tm-resource-explorer {
    margin: 0;

    border: 0;
    border-radius: 0;

    background: transparent;

    height: 100%;

    min-height: 0;

    display: flex;
    flex-direction: column;
}


.tm-resource-summary {
    display: none;
}


.tm-resource-toolbar {
    flex: 0 0 auto;

    display: flex;

    gap: 6px;

    padding:
        10px
        12px;
}


.tm-resource-tool-button {
    border:
        1px solid
        rgba(255,255,255,.08);

    border-radius: 8px;

    background:
        rgba(255,255,255,.035);

    color: inherit;

    padding:
        7px
        10px;

    font-size: .75rem;

    cursor: pointer;
}


.tm-resource-tool-button:hover {
    background:
        rgba(255,255,255,.08);
}


.tm-resource-path,
.tm-resource-selection {
    flex: 0 0 auto;

    padding:
        9px
        12px;
}


.tm-resource-label {
    margin-bottom: 5px;

    font-size: .65rem;

    opacity: .45;

    text-transform: uppercase;

    letter-spacing: .04em;
}


.tm-resource-path code,
.tm-resource-selection code {
    display: block;

    padding:
        7px
        8px;

    border-radius: 7px;

    background:
        rgba(0,0,0,.22);

    font-size: .72rem;

    line-height: 1.35;

    overflow-wrap: anywhere;
}


.tm-resource-entries {
    flex: 1 1 auto;

    min-height: 100px;
    max-height: none;

    overflow-y: auto;

    display: flex;
    flex-direction: column;

    gap: 2px;

    padding:
        5px
        8px;

    border-top:
        1px solid
        rgba(255,255,255,.045);

    border-bottom:
        1px solid
        rgba(255,255,255,.045);
}


.tm-resource-entry {
    width: 100%;

    flex: 0 0 auto;

    min-height: 34px;

    display: flex;

    align-items: center;

    gap: 8px;

    border: 0;

    border-radius: 7px;

    background:
        transparent;

    color: inherit;

    padding:
        6px
        8px;

    text-align: left;

    cursor: pointer;
}


.tm-resource-entry:hover {
    background:
        rgba(255,255,255,.055);
}


.tm-resource-entry.is-selected {
    background:
        rgba(210,54,121,.14);

    outline:
        1px solid
        rgba(210,54,121,.40);
}


.tm-resource-entry-icon {
    width: 20px;

    flex-shrink: 0;

    text-align: center;
}


.tm-resource-entry-name {
    min-width: 0;

    overflow: hidden;

    white-space: nowrap;

    text-overflow: ellipsis;

    font-size: .8rem;
}


.tm-resource-selection-actions {
    flex: 0 0 auto;

    display: grid;

    grid-template-columns:
        1fr
        1fr;

    gap: 6px;

    padding:
        8px
        12px
        12px;
}


/* ============================================================
   WORKERS
   ============================================================ */

.tm-worker-panel,
.tm-job-panel {
    flex: 1 1 auto;

    min-height: 0;

    overflow-y: auto;

    padding:
        14px
        12px;
}


.tm-worker-summary {
    margin-bottom: 12px;

    padding:
        9px;

    border-radius: 8px;

    background:
        rgba(255,255,255,.035);

    font-size: .75rem;
}


.tm-worker-static-list {
    display: grid;

    gap: 6px;
}


.tm-worker-card {
    display: flex;

    justify-content: space-between;
    align-items: center;

    gap: 10px;

    padding:
        10px;

    border:
        1px solid
        rgba(255,255,255,.06);

    border-radius: 9px;

    background:
        rgba(255,255,255,.025);
}


.tm-worker-card > div {
    display: grid;
    gap: 3px;
}


.tm-worker-card strong {
    font-size: .82rem;
}


.tm-worker-card span {
    font-size: .69rem;
    opacity: .55;
}


.tm-worker-dot {
    width: 8px;
    height: 8px;

    border-radius: 50%;

    background: #42df93;
}


/* ============================================================
   JOB
   ============================================================ */

.tm-job-panel {
    display: flex;
    flex-direction: column;

    gap: 12px;
}


.tm-job-field {
    display: grid;

    gap: 5px;

    font-size: .72rem;
}


.tm-job-field > span {
    opacity: .55;
}


.tm-resource-action {
    min-height: 36px;

    border:
        1px solid
        rgba(255,255,255,.09);

    border-radius: 8px;

    background:
        rgba(255,255,255,.04);

    color: inherit;

    padding:
        7px
        10px;

    cursor: pointer;

    font-size: .75rem;
}


.tm-resource-action:hover:not(:disabled) {
    background:
        rgba(255,255,255,.09);
}


.tm-resource-action:disabled {
    opacity: .35;

    cursor: not-allowed;
}


.tm-resource-run {
    background:
        #cf3678;

    border-color:
        #cf3678;

    color: white;

    font-weight: 650;
}


.tm-job-result {
    margin-top: auto;

    padding:
        10px;

    border-radius: 8px;

    background:
        rgba(255,255,255,.03);

    font-size: .72rem;

    line-height: 1.4;

    overflow-wrap: anywhere;
}


/* ============================================================
   CONVERSATION WORKSPACE
   ============================================================ */

.tm-conversation-workspace {
    min-width: 0;
    min-height: 0;

    display: flex;
    flex-direction: column;

    background:
        #0b1017;
}


/* ============================================================
   COMPOSER
   ============================================================ */

.tm-composer {
    flex: 0 0 auto;

    margin: 0;

    padding:
        18px
        20px;

    border-bottom:
        1px solid
        rgba(255,255,255,.07);

    background:
        #101721;
}


.tm-composer-title-row {
    margin-bottom: 10px;
}


.tm-composer-title {
    font-size: .88rem;
    font-weight: 700;
}


.tm-composer-subtitle {
    margin-top: 2px;

    font-size: .69rem;

    opacity: .45;
}


.tm-composer-input {
    width: 100%;

    min-height: 95px;

    resize: vertical;

    padding:
        13px
        14px;

    border:
        1px solid
        rgba(255,255,255,.08);

    border-radius: 10px;

    background:
        #080d13;

    color: inherit;

    outline: none;

    line-height: 1.45;
}


.tm-composer-input:focus {
    border-color:
        rgba(210,54,121,.65);

    box-shadow:
        0 0 0 2px
        rgba(210,54,121,.09);
}


.tm-composer-footer {
    display: flex;

    justify-content: space-between;
    align-items: center;

    gap: 12px;

    margin-top: 9px;
}


.tm-send-button {
    min-width: 110px;
}


/* ============================================================
   CONVERSA
   ============================================================ */

.tm-conversation-header {
    flex: 0 0 auto;

    padding:
        13px
        20px
        10px;

    border-bottom:
        1px solid
        rgba(255,255,255,.045);
}


.tm-conversation-title {
    font-size: .85rem;
    font-weight: 700;
}


.tm-conversation-subtitle {
    margin-top: 2px;

    font-size: .68rem;

    opacity: .4;
}


.tm-conversation-stream {
    flex: 1 1 auto;

    min-height: 0;

    overflow-y: auto;

    padding:
        18px
        20px
        40px;

    border: 0;
}


.tm-conversation-stream
.tm-message {
    max-width: 820px;
}


/* ============================================================
   SCROLLBARS
   ============================================================ */

.tm-resource-entries,
.tm-worker-panel,
.tm-job-panel,
.tm-conversation-stream {
    scrollbar-width: thin;
}


/* ============================================================
   DESKTOP LARGO
   ============================================================ */

@media (min-width: 1500px) {

    .tm-ai-workspace {
        grid-template-columns:
            350px
            minmax(0, 1fr);
    }

}


/* ============================================================
   TABLET
   ============================================================ */

@media (max-width: 1000px) {

    .tm-ai-workspace {
        grid-template-columns:
            270px
            minmax(0, 1fr);
    }


    .tm-mode-status {
        display: none;
    }

}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 760px) {

    .tm-chat-page {
        padding: 6px;
    }


    .tm-chat-shell {
        border-radius: 12px;
    }


    .tm-workstation-header {
        min-height: auto;

        padding:
            12px
            13px;
    }


    .tm-ai-workspace {
        display: flex;
        flex-direction: column;
    }


    .tm-resource-sidebar {
        flex: 0 0 auto;

        max-height: 42vh;

        border-right: 0;

        border-bottom:
            1px solid
            rgba(255,255,255,.08);
    }


    .tm-resource-tab-panel.is-active {
        max-height: 32vh;
    }


    .tm-resource-entries {
        max-height: 180px;
    }


    .tm-conversation-workspace {
        flex: 1 1 auto;
        min-height: 0;
    }


    .tm-composer {
        padding: 12px;
    }


    .tm-conversation-stream {
        padding:
            12px
            12px
            30px;
    }

}


/* ============================================================
   PHONE
   ============================================================ */

@media (max-width: 520px) {

    .tm-workstation-mode label,
    .tm-sidebar-subtitle {
        display: none;
    }


    .tm-workstation-header {
        gap: 8px;
    }


    .tm-resource-tabs {
        padding:
            0
            6px
            6px;
    }


    .tm-resource-tab {
        font-size: .67rem;
    }


    .tm-composer-footer {
        flex-direction: column;

        align-items: stretch;
    }


    .tm-send-button {
        width: 100%;
    }

}



/* ============================================================
   TM01GPT — SCROLL INDEPENDENTE DO EXPLORADOR
   ============================================================ */

.tm-resource-sidebar {
    min-height: 0;
    overflow: hidden;
}


/* Tab ativa ocupa a altura disponível */
.tm-resource-tab-panel.is-active {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}


/* Explorador completo */
.tm-resource-explorer {
    flex: 1 1 auto;
    min-height: 0;

    display: flex;
    flex-direction: column;

    overflow: hidden;
}


/* Só a lista de ficheiros faz scroll */
.tm-resource-entries {
    flex: 1 1 auto;

    min-height: 0;
    max-height: none;

    overflow-y: auto;
    overflow-x: hidden;

    overscroll-behavior: contain;

    scrollbar-width: thin;
}


/* Workers */
.tm-worker-panel {
    flex: 1 1 auto;

    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    overscroll-behavior: contain;

    scrollbar-width: thin;
}


/* Jobs */
.tm-job-panel {
    flex: 1 1 auto;

    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    overscroll-behavior: contain;

    scrollbar-width: thin;
}


/* Conversa */
.tm-conversation-stream {
    flex: 1 1 auto;

    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    overscroll-behavior: contain;

    scrollbar-width: thin;
}


/* Chrome / Edge */
.tm-resource-entries::-webkit-scrollbar,
.tm-worker-panel::-webkit-scrollbar,
.tm-job-panel::-webkit-scrollbar,
.tm-conversation-stream::-webkit-scrollbar {
    width: 8px;
}


.tm-resource-entries::-webkit-scrollbar-thumb,
.tm-worker-panel::-webkit-scrollbar-thumb,
.tm-job-panel::-webkit-scrollbar-thumb,
.tm-conversation-stream::-webkit-scrollbar-thumb {
    background:
        rgba(255,255,255,.14);

    border-radius: 10px;
}


.tm-resource-entries::-webkit-scrollbar-thumb:hover,
.tm-worker-panel::-webkit-scrollbar-thumb:hover,
.tm-job-panel::-webkit-scrollbar-thumb:hover,
.tm-conversation-stream::-webkit-scrollbar-thumb:hover {
    background:
        rgba(255,255,255,.24);
}



/* ============================================================
   EXPLORADOR — AÇÕES DIRETAS
   ============================================================ */

.tm-resource-selection-actions {
    grid-template-columns:
        repeat(3, 1fr);
}


.tm-resource-worker-button:not(:disabled) {
    border-color:
        rgba(210,54,121,.45);

    background:
        rgba(210,54,121,.10);
}


.tm-resource-worker-button:not(:disabled):hover {
    background:
        rgba(210,54,121,.20);
}


/* Indicação visual de pasta navegável */

.tm-resource-entry[data-type="directory"] {
    cursor: default;
}


/* Mantém lista de ficheiros com scroll próprio */

.tm-resource-entries {
    overflow-y: auto !important;
    overflow-x: hidden !important;

    min-height: 0 !important;

    scrollbar-width: thin;
}


@media (max-width: 520px) {

    .tm-resource-selection-actions {
        grid-template-columns:
            1fr;
    }

}



/* ============================================================
   EXPLORADOR — SELEÇÃO E AÇÕES NO TOPO
   ============================================================ */

.tm-resource-explorer,
.tm-resource-explorer[open] {
    display: flex !important;
    flex-direction: column !important;
}


/* ordem dos blocos */

.tm-resource-selection {
    order: 1 !important;
}

.tm-resource-selection-actions {
    order: 2 !important;
}

.tm-resource-toolbar {
    order: 3 !important;
}

.tm-resource-path {
    order: 4 !important;
}

.tm-resource-entries {
    order: 5 !important;
}


/* seleção destacada no topo */

.tm-resource-selection {
    flex: 0 0 auto !important;

    padding:
        10px
        12px
        7px !important;

    border-bottom:
        1px solid rgba(255,255,255,.06);

    background:
        rgba(255,255,255,.02);
}


/* botões logo a seguir ao selecionado */

.tm-resource-selection-actions {
    flex: 0 0 auto !important;

    display: grid !important;

    grid-template-columns:
        repeat(3, minmax(0,1fr)) !important;

    gap: 6px !important;

    padding:
        7px
        12px
        10px !important;

    border-bottom:
        1px solid rgba(255,255,255,.06);

    background:
        rgba(255,255,255,.02);
}


/* navegação vem depois */

.tm-resource-toolbar {
    flex: 0 0 auto !important;

    padding:
        10px
        12px
        6px !important;
}


.tm-resource-path {
    flex: 0 0 auto !important;

    padding:
        6px
        12px
        10px !important;
}


/* lista ocupa todo o espaço restante e faz scroll */

.tm-resource-entries {
    flex: 1 1 0 !important;

    min-height: 0 !important;
    height: 0 !important;

    overflow-y: auto !important;
    overflow-x: hidden !important;

    border-top:
        1px solid rgba(255,255,255,.05);
}


/* selecionado mais compacto */

.tm-resource-selection code {
    display: block !important;

    max-height: 45px !important;

    overflow-y: auto !important;

    font-size: .72rem !important;
}


/* mobile */

@media (max-width: 520px) {

    .tm-resource-selection-actions {
        grid-template-columns:
            repeat(3,1fr) !important;
    }

}



/* ============================================================
   TM01GPT — SMARTPHONE / MOBILE
   ============================================================ */

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}


/* ------------------------------------------------------------
   TABLET / SMARTPHONE
   ------------------------------------------------------------ */

@media (max-width: 900px) {

    .tm-main {
        width: 100%;
        max-width: 100%;
        padding-left: 8px;
        padding-right: 8px;
    }


    /*
     * Layout principal:
     * no mobile ficamos essencialmente com a conversa.
     */

    .tm-workspace,
    .tm-chat-layout,
    .tm-layout,
    .tm-grid {
        grid-template-columns: 1fr !important;
    }


    /*
     * Barras laterais deixam de consumir espaço.
     * Mais tarde podemos ligá-las a botões drawer.
     */

    .tm-resource-sidebar,
    .tm-resources-panel,
    .tm-left-sidebar,
    .tm-right-sidebar,
    .tm-workspace-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;

        width: min(88vw, 360px);
        max-width: 360px;

        z-index: 1000;

        background: var(--tm-panel, #11161f);

        box-shadow:
            0 0 24px
            rgba(0, 0, 0, 0.35);

        overflow-y: auto;

        transition:
            transform 0.22s ease;
    }


    .tm-left-sidebar,
    .tm-resource-sidebar,
    .tm-resources-panel {
        left: 0;

        transform:
            translateX(-105%);
    }


    .tm-right-sidebar,
    .tm-workspace-sidebar {
        right: 0;

        transform:
            translateX(105%);
    }


    .tm-left-sidebar.is-open,
    .tm-resource-sidebar.is-open,
    .tm-resources-panel.is-open,
    .tm-right-sidebar.is-open,
    .tm-workspace-sidebar.is-open {
        transform:
            translateX(0);
    }


    /*
     * Conversa principal.
     */

    .tm-chat {
        width: 100%;
        min-width: 0;
        max-width: 100%;

        border-radius: 12px;
    }


    .tm-chat-header {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;

        padding: 10px 12px;
    }


    .tm-chat-title {
        width: 100%;
    }


    .tm-chat-status {
        width: 100%;

        font-size: 12px;
    }


    /*
     * Selector Chat / Coder / Kiwi.
     */

    #tm-mode {
        width: 100%;

        min-height: 42px;

        font-size: 16px;
    }


    /*
     * Área de mensagens.
     */

    .tm-messages {
        width: 100%;

        padding-left: 8px;
        padding-right: 8px;
    }


    .tm-message {
        max-width: 94%;

        padding: 10px 12px;

        font-size: 15px;
        line-height: 1.45;

        word-break: break-word;
        overflow-wrap: anywhere;
    }


    .tm-message-user {
        max-width: 90%;
    }


    .tm-message-assistant {
        max-width: 96%;
    }


    .tm-message pre {
        max-width: 100%;

        overflow-x: auto;

        font-size: 13px;
    }


    .tm-message code {
        word-break: break-word;
    }


    /*
     * Composer.
     */

    .tm-chat-form {
        width: 100%;

        padding:
            8px
            8px
            calc(8px + env(safe-area-inset-bottom));
    }


    .tm-chat-input {
        width: 100%;

        min-height: 88px;
        max-height: 38vh;

        padding: 12px;

        font-size: 16px;
        line-height: 1.4;

        resize: vertical;
    }


    /*
     * 16px evita zoom automático
     * do browser em vários smartphones.
     */

    textarea,
    input,
    select,
    button {
        font-size: 16px;
    }


    .tm-chat-form-footer {
        display: grid;

        grid-template-columns:
            minmax(0, 1fr)
            auto;

        gap: 8px;

        align-items: center;
    }


    .tm-chat-hint {
        font-size: 11px;

        opacity: 0.65;
    }


    #send-button {
        min-width: 92px;
        min-height: 44px;

        padding: 9px 14px;

        border-radius: 9px;
    }


    /*
     * Controlos Coder.
     */

    .tm-coder-controls {
        display: grid;

        grid-template-columns: 1fr;

        gap: 10px;

        padding: 10px;
    }


    .tm-coder-control {
        width: 100%;
    }


    .tm-coder-control select,
    .tm-coder-control input {
        width: 100%;

        min-height: 42px;
    }


    /*
     * KIWI MOBILE
     */

    .tm-kiwi-controls {
        display: grid;

        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );

        gap: 8px;

        padding: 10px;
        margin-top: 8px;
    }


    .tm-kiwi-control {
        min-width: 0;
        width: 100%;
    }


    .tm-kiwi-control label {
        font-size: 11px;
    }


    .tm-kiwi-control select,
    .tm-kiwi-control input {
        width: 100%;

        min-width: 0;
        min-height: 42px;

        font-size: 16px;
    }


    .tm-kiwi-status {
        grid-column:
            1 / -1;

        width: 100%;

        margin: 0;

        padding: 7px 8px;

        text-align: left;

        font-size: 11px;
    }


    /*
     * Conversas / Projectos.
     */

    .tm-conversation-item,
    .tm-project-item {
        min-height: 44px;

        padding: 10px;
    }


    /*
     * Navegação superior.
     */

    .tm-tabs {
        width: 100%;

        overflow-x: auto;

        flex-wrap: nowrap;

        scrollbar-width: none;
    }


    .tm-tabs::-webkit-scrollbar {
        display: none;
    }


    .tm-tab {
        flex: 0 0 auto;

        min-height: 42px;

        padding: 9px 12px;
    }
}


/* ------------------------------------------------------------
   SMARTPHONES PEQUENOS
   ------------------------------------------------------------ */

@media (max-width: 520px) {

    .tm-main {
        padding-left: 4px;
        padding-right: 4px;
    }


    .tm-chat {
        border-radius: 8px;
    }


    .tm-chat-header {
        padding: 8px;
    }


    .tm-messages {
        padding-left: 4px;
        padding-right: 4px;
    }


    .tm-message {
        max-width: 98%;

        padding: 9px 10px;

        font-size: 14px;
    }


    .tm-message-user {
        max-width: 94%;
    }


    /*
     * Kiwi passa a uma coluna
     * em ecrãs muito estreitos.
     */

    .tm-kiwi-controls {
        grid-template-columns: 1fr;
    }


    .tm-kiwi-status {
        grid-column: 1;
    }


    .tm-chat-form-footer {
        grid-template-columns: 1fr;
    }


    .tm-chat-hint {
        order: 2;

        text-align: center;
    }


    #send-button {
        width: 100%;

        min-height: 46px;
    }


    .tm-chat-input {
        min-height: 96px;
    }
}


/* ------------------------------------------------------------
   SAFE AREA — ANDROID / IOS
   ------------------------------------------------------------ */

@supports (
    padding-bottom:
        env(safe-area-inset-bottom)
) {

    .tm-chat-form {
        padding-bottom:
            calc(
                8px
                +
                env(safe-area-inset-bottom)
            );
    }


    .tm-tabs {
        padding-left:
            env(safe-area-inset-left);

        padding-right:
            env(safe-area-inset-right);
    }
}


/* ------------------------------------------------------------
   TOUCH
   ------------------------------------------------------------ */

@media (hover: none) and (pointer: coarse) {

    button,
    select,
    input,
    textarea,
    .tm-tab,
    .tm-conversation-item {
        touch-action: manipulation;
    }


    button,
    .tm-tab {
        min-height: 44px;
    }
}


/* ============================================================
   TM01GPT — MOBILE WORKSPACE FINAL
   conversa prioritária
   ============================================================ */

@media (max-width: 760px) {

    html,
    body {
        width: 100%;
        max-width: 100%;

        overflow-x: hidden;
    }


    .tm-chat-page {
        padding: 4px !important;
    }


    .tm-chat-shell {
        width: 100% !important;
        max-width: 100% !important;

        min-height: calc(100dvh - 150px);

        border-radius: 10px !important;
    }


    /* --------------------------------------------------------
       CABEÇALHO DA WORKSTATION
       -------------------------------------------------------- */

    .tm-workstation-header {
        display: grid !important;

        grid-template-columns:
            minmax(0, 1fr)
            auto !important;

        gap: 6px !important;

        padding: 8px 10px !important;
    }


    .tm-workstation-title,
    .tm-workstation-mode {
        min-width: 0;
    }


    .tm-workstation-mode select,
    #tm-mode {
        width: 100% !important;
        max-width: 170px;

        min-height: 40px;
    }


    .tm-mode-status {
        display: none !important;
    }


    /* --------------------------------------------------------
       WORKSPACE
       -------------------------------------------------------- */

    .tm-ai-workspace {
        position: relative !important;

        display: block !important;

        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;

        overflow: visible !important;
    }


    /* --------------------------------------------------------
       RECURSOS:
       deixam de ocupar espaço permanente
       -------------------------------------------------------- */

    .tm-resource-sidebar {
        position: fixed !important;

        z-index: 5000 !important;

        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;

        width: min(88vw, 360px) !important;
        height: 100dvh !important;
        max-height: none !important;

        transform:
            translateX(-105%) !important;

        transition:
            transform .22s ease !important;

        border-right:
            1px solid rgba(255,255,255,.10) !important;

        border-bottom: 0 !important;

        box-shadow:
            12px 0 35px
            rgba(0,0,0,.45);

        overflow: hidden !important;
    }


    .tm-resource-sidebar.is-open {
        transform:
            translateX(0) !important;
    }


    /* --------------------------------------------------------
       CONVERSA PRINCIPAL
       -------------------------------------------------------- */

    .tm-conversation-workspace {
        width: 100% !important;

        min-width: 0 !important;
        min-height: 0 !important;

        display: flex !important;
        flex-direction: column !important;
    }


    .tm-conversation-stream,
    .tm-messages {
        width: 100% !important;

        min-height: 40vh;

        padding:
            10px
            8px
            18px !important;
    }


    .tm-message {
        max-width: 96% !important;

        font-size: .93rem !important;

        line-height: 1.48 !important;
    }


    .tm-message-user {
        max-width: 90% !important;
    }


    /* --------------------------------------------------------
       COMPOSER
       -------------------------------------------------------- */

    .tm-chat-form,
    .tm-composer {
        width: 100% !important;

        padding:
            8px
            8px
            calc(
                8px
                +
                env(safe-area-inset-bottom)
            ) !important;
    }


    .tm-chat-input,
    #message {
        width: 100% !important;

        min-height: 100px !important;
        max-height: 34vh !important;

        padding: 12px !important;

        font-size: 16px !important;

        box-sizing: border-box;
    }


    .tm-chat-form-footer,
    .tm-composer-footer {
        display: grid !important;

        grid-template-columns:
            minmax(0,1fr)
            auto !important;

        gap: 7px !important;

        align-items: center !important;
    }


    #send-button,
    .tm-send-button {
        min-width: 92px !important;
        min-height: 44px !important;
    }


    /* --------------------------------------------------------
       KIWI
       -------------------------------------------------------- */

    .tm-kiwi-controls {
        display: grid !important;

        grid-template-columns:
            repeat(2,minmax(0,1fr)) !important;

        gap: 7px !important;

        margin: 6px 8px !important;

        padding: 9px !important;
    }


    .tm-kiwi-controls[hidden] {
        display: none !important;
    }


    .tm-kiwi-control {
        min-width: 0 !important;
    }


    .tm-kiwi-control select,
    .tm-kiwi-control input {
        width: 100% !important;

        min-height: 40px !important;

        font-size: 16px !important;
    }


    .tm-kiwi-status {
        grid-column:
            1 / -1;

        width: 100% !important;

        margin: 0 !important;

        font-size: .70rem !important;
    }


    /* --------------------------------------------------------
       CODER
       -------------------------------------------------------- */

    .tm-coder-controls,
    .tm-coder-bar {
        display: grid !important;

        grid-template-columns:
            1fr !important;

        gap: 8px !important;
    }


    /* --------------------------------------------------------
       NAV SUPERIOR
       -------------------------------------------------------- */

    .tm-tabs {
        display: flex !important;

        width: 100% !important;

        flex-wrap: nowrap !important;

        overflow-x: auto !important;

        overscroll-behavior-x:
            contain;

        scrollbar-width: none;
    }


    .tm-tabs::-webkit-scrollbar {
        display: none;
    }


    .tm-tab {
        flex: 0 0 auto !important;

        white-space: nowrap;

        padding:
            9px
            11px !important;
    }


    /* --------------------------------------------------------
       BOTÃO MOBILE RECURSOS
       -------------------------------------------------------- */

    #tm-mobile-resources-button {
        position: fixed;

        left: 12px;
        bottom:
            calc(
                12px
                +
                env(safe-area-inset-bottom)
            );

        z-index: 4900;

        width: 46px;
        height: 46px;

        border: 1px solid
            rgba(255,255,255,.12);

        border-radius: 50%;

        background:
            #151d29;

        color: inherit;

        font-size: 21px;

        box-shadow:
            0 5px 18px
            rgba(0,0,0,.35);
    }


    #tm-mobile-resource-overlay {
        position: fixed;

        inset: 0;

        z-index: 4990;

        display: none;

        background:
            rgba(0,0,0,.52);
    }


    #tm-mobile-resource-overlay.is-open {
        display: block;
    }
}


/* ============================================================
   TELEFONES PEQUENOS
   ============================================================ */

@media (max-width: 520px) {

    .tm-workstation-header {
        grid-template-columns:
            1fr !important;
    }


    .tm-workstation-mode select,
    #tm-mode {
        max-width: none !important;
    }


    .tm-kiwi-controls {
        grid-template-columns:
            1fr !important;
    }


    .tm-chat-form-footer,
    .tm-composer-footer {
        grid-template-columns:
            1fr !important;
    }


    #send-button,
    .tm-send-button {
        width: 100% !important;
    }


    .tm-chat-hint {
        text-align: center;
    }
}

.tm-user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--tm-soft);
    font-size: 13px;
    white-space: nowrap;
}

.tm-user-logout {
    border: 1px solid var(--tm-border);
    border-radius: 7px;
    padding: 6px 10px;
    background: var(--tm-panel);
    color: var(--tm-muted);
    cursor: pointer;
}

.tm-user-logout:hover {
    color: var(--tm-text);
    border-color: var(--tm-accent);
}


/* ============================================================
   TM01GPT — MOBILE HEADER DEFINITIVO
   2026-10
   ============================================================ */

@media (max-width: 760px) {

    /* Cabeçalho principal numa única linha */
    .tm-header {
        min-height: 58px !important;
        height: auto !important;

        display: flex !important;
        flex-wrap: nowrap !important;

        align-items: center !important;
        justify-content: space-between !important;

        gap: 8px !important;

        padding:
            7px
            10px !important;
    }


    /* Marca */
    .tm-brand {
        flex: 0 1 auto !important;

        min-width: 0 !important;

        gap: 8px !important;
    }


    .tm-brand-mark {
        width: 36px !important;
        height: 36px !important;

        border-radius: 9px !important;

        font-size: 12px !important;
    }


    .tm-brand-name {
        font-size: 14px !important;
    }


    /*
     * No telefone não precisamos da segunda linha
     * "Inteligência interna".
     */
    .tm-brand-subtitle {
        display: none !important;
    }


    /*
     * Os atalhos grandes pertencem ao desktop.
     * A navegação já dá acesso ao Chat e Vídeo.
     */
    .tm-header-actions {
        display: none !important;
    }


    /*
     * Utilizador/logout deixa de ocupar uma linha
     * inteira no smartphone.
     */
    .tm-user-menu {
        display: none !important;
    }


    /*
     * Navegação continua disponível, mas ocupa apenas
     * o espaço restante da mesma linha.
     */
    #tm-nav {
        width: auto !important;

        min-width: 0 !important;

        flex:
            1
            1
            auto !important;

        order: initial !important;

        overflow: hidden;
    }


    .tm-tabs {
        width: 100% !important;

        display: flex !important;

        align-items: center !important;
        justify-content: flex-end !important;

        gap: 2px !important;

        padding: 0 !important;

        overflow-x: auto !important;

        scrollbar-width: none;
    }


    .tm-tabs::-webkit-scrollbar {
        display: none;
    }


    .tm-tab {
        flex: 0 0 auto !important;

        min-height: 36px !important;

        padding:
            0
            6px !important;

        font-size: 12px !important;
    }

}


/* Telefones particularmente estreitos */
@media (max-width: 420px) {

    .tm-header {
        padding:
            6px
            8px !important;
    }


    .tm-brand-mark {
        width: 34px !important;
        height: 34px !important;
    }


    .tm-brand-name {
        font-size: 13px !important;
    }


    .tm-tab {
        padding:
            0
            5px !important;

        font-size: 11px !important;
    }

}


/* ============================================================
   TM01GPT — MOBILE HEADER ESTÁVEL
   2026-10-03
   ============================================================ */

@media (max-width: 760px) {

    .tm-header {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;

        width: 100% !important;
        max-width: 100% !important;

        gap: 8px !important;

        overflow: hidden !important;
    }


    /* Marca fica sempre visível */
    .tm-brand {
        flex: 0 0 auto !important;
        min-width: auto !important;
        max-width: none !important;
    }


    /* Navegação recebe apenas o espaço que sobra */
    #tm-nav {
        display: block !important;

        flex: 1 1 0 !important;

        width: 0 !important;
        min-width: 0 !important;
        max-width: 100% !important;

        overflow: hidden !important;
    }


    /* Separadores começam à esquerda.
       Se não couberem, fazem scroll horizontal. */
    #tm-nav .tm-tabs {
        display: flex !important;

        width: 100% !important;
        max-width: 100% !important;

        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        align-items: center !important;

        gap: 2px !important;

        overflow-x: auto !important;
        overflow-y: hidden !important;

        scrollbar-width: none !important;
        -webkit-overflow-scrolling: touch;
    }


    #tm-nav .tm-tabs::-webkit-scrollbar {
        display: none !important;
    }


    #tm-nav .tm-tab {
        flex: 0 0 auto !important;

        min-width: 0 !important;
        min-height: 36px !important;

        padding: 0 6px !important;

        white-space: nowrap !important;

        font-size: 12px !important;
    }

}


@media (max-width: 420px) {

    #tm-nav .tm-tab {
        padding: 0 5px !important;
        font-size: 11px !important;
    }

}


/* ============================================================
   TM01GPT — PASTAS DO PROJETO / MULTI-ROOT
   ============================================================ */

.tm-project-roots {
    flex: 0 0 auto;

    padding:
        9px
        10px;

    border-bottom:
        1px solid
        rgba(255,255,255,.06);

    background:
        rgba(255,255,255,.012);
}


.tm-project-roots-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 8px;

    margin-bottom: 7px;
}


.tm-project-roots-title {
    font-size: .62rem;

    font-weight: 700;

    text-transform: uppercase;

    letter-spacing: .055em;

    opacity: .5;
}


.tm-project-roots-add {
    min-height: 27px;

    padding:
        4px
        8px;

    border:
        1px solid
        rgba(255,255,255,.10);

    border-radius: 7px;

    background:
        rgba(255,255,255,.045);

    color: inherit;

    font-size: .66rem;

    cursor: pointer;
}


.tm-project-roots-add:hover {
    background:
        rgba(255,255,255,.09);
}


.tm-project-roots-list {
    display: flex;

    flex-direction: column;

    gap: 5px;

    max-height: 170px;

    overflow-y: auto;
}


.tm-project-root-item {
    display: grid;

    grid-template-columns:
        minmax(0,1fr)
        29px;

    gap: 4px;

    border:
        1px solid
        rgba(255,255,255,.055);

    border-radius: 8px;

    background:
        rgba(0,0,0,.13);
}


.tm-project-root-item.is-active {
    border-color:
        rgba(224,55,132,.55);

    background:
        rgba(224,55,132,.09);
}


.tm-project-root-select {
    display: grid;

    grid-template-columns:
        20px
        minmax(0,1fr);

    align-items: center;

    min-width: 0;

    padding:
        7px
        5px
        7px
        7px;

    border: 0;

    background: transparent;

    color: inherit;

    text-align: left;

    cursor: pointer;
}


.tm-project-root-icon {
    grid-row:
        1 / 3;

    font-size: .8rem;
}


.tm-project-root-name {
    overflow: hidden;

    font-size: .72rem;

    font-weight: 600;

    white-space: nowrap;

    text-overflow: ellipsis;
}


.tm-project-root-path {
    overflow: hidden;

    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Consolas,
        monospace;

    font-size: .57rem;

    opacity: .42;

    white-space: nowrap;

    text-overflow: ellipsis;
}


.tm-project-root-remove {
    align-self: stretch;

    border: 0;

    border-left:
        1px solid
        rgba(255,255,255,.05);

    background: transparent;

    color: inherit;

    font-size: 1rem;

    opacity: .45;

    cursor: pointer;
}


.tm-project-root-remove:hover {
    opacity: 1;

    background:
        rgba(255,80,80,.10);
}


.tm-project-roots-empty {
    padding:
        7px;

    font-size: .66rem;

    opacity: .4;
}


@media (max-width: 760px) {

    .tm-project-roots-list {
        max-height: 145px;
    }


    .tm-project-roots-add {
        min-height: 34px;

        font-size: .72rem;
    }
}


/* ============================================================
   TM01GPT — PASTAS ASSOCIADAS NO PEDIDO
   ============================================================ */

.tm-pedido-project-roots {
    margin-bottom: 10px;

    padding:
        8px
        9px;

    border:
        1px solid
        rgba(255,255,255,.06);

    border-radius: 9px;

    background:
        rgba(255,255,255,.018);
}


.tm-pedido-project-roots[hidden] {
    display: none !important;
}


.tm-pedido-project-roots-title {
    margin-bottom: 7px;

    font-size: .62rem;

    font-weight: 700;

    text-transform: uppercase;

    letter-spacing: .055em;

    opacity: .45;
}


.tm-pedido-project-roots-list {
    display: flex;

    flex-wrap: wrap;

    gap: 6px;
}


.tm-pedido-project-root {
    display: grid;

    grid-template-columns:
        17px
        minmax(0,1fr);

    min-width: 150px;
    max-width: 260px;

    padding:
        6px
        8px;

    border:
        1px solid
        rgba(255,255,255,.07);

    border-radius: 8px;

    background:
        rgba(0,0,0,.14);

    color: inherit;

    text-align: left;

    cursor: pointer;
}


.tm-pedido-project-root:hover {
    background:
        rgba(255,255,255,.045);
}


.tm-pedido-project-root.is-active {
    border-color:
        rgba(224,55,132,.55);

    background:
        rgba(224,55,132,.10);
}


.tm-pedido-project-root-icon {
    grid-row:
        1 / 3;

    font-size: .75rem;
}


.tm-pedido-project-root-name {
    overflow: hidden;

    font-size: .69rem;

    font-weight: 600;

    white-space: nowrap;

    text-overflow: ellipsis;
}


.tm-pedido-project-root-path {
    overflow: hidden;

    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Consolas,
        monospace;

    font-size: .54rem;

    opacity: .38;

    white-space: nowrap;

    text-overflow: ellipsis;
}


/* ------------------------------------------------------------
   DESKTOP
   ------------------------------------------------------------ */

@media (min-width: 900px) {

    .tm-pedido-project-roots-list {
        display: grid;

        grid-template-columns:
            repeat(
                auto-fit,
                minmax(170px,1fr)
            );
    }


    .tm-pedido-project-root {
        max-width: none;
    }
}


/* ------------------------------------------------------------
   MOBILE
   ------------------------------------------------------------ */

@media (max-width: 760px) {

    .tm-pedido-project-roots {
        margin-bottom: 8px;

        padding: 7px;
    }


    .tm-pedido-project-roots-list {
        flex-wrap: nowrap;

        overflow-x: auto;

        scrollbar-width: none;
    }


    .tm-pedido-project-roots-list::-webkit-scrollbar {
        display: none;
    }


    .tm-pedido-project-root {
        flex: 0 0 190px;

        min-width: 190px;
    }
}


/* ORIGEM: chat.css */
/* ============================================================
   TM01GPT
   CHAT / CODER / RESOURCE WORKSTATION
   ============================================================ */


/* ============================================================
   PÁGINA
   ============================================================ */

html,
body {
    height: 100%;
}

body {
    overflow: hidden;
}

.tm-chat-page {
    height:
        calc(
            100dvh -
            var(--tm-header-height)
        );

    min-height: 0;

    padding:
        18px
        clamp(10px, 3vw, 24px);

    overflow: hidden;
}


/* ============================================================
   SHELL PRINCIPAL
   ============================================================ */

.tm-chat-shell {
    width: min(1500px, 100%);
    height: 100%;

    min-height: 0;

    margin: 0 auto;

    display: flex;
    flex-direction: column;

    background: #0b1017;

    border:
        1px solid
        rgba(255,255,255,.08);

    border-radius: 18px;

    overflow: hidden;

    box-shadow:
        0 20px 60px
        rgba(0,0,0,.22);
}


/* ============================================================
   CABEÇALHO TM01GPT
   ============================================================ */

.tm-workstation-header {
    flex: 0 0 auto;

    min-height: 82px;

    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 22px;

    padding:
        17px
        21px;

    background: #141b26;

    border-bottom:
        1px solid
        rgba(255,255,255,.08);
}


.tm-workstation-identity {
    min-width: 0;
}


.tm-workstation-title {
    font-size: 1.1rem;
    font-weight: 750;

    line-height: 1.2;
}


.tm-workstation-status {
    display: flex;

    align-items: center;

    gap: 7px;

    margin-top: 6px;

    font-size: .75rem;

    opacity: .65;
}


.tm-status-dot {
    width: 8px;
    height: 8px;

    flex: 0 0 auto;

    border-radius: 50%;

    background: #43df93;

    box-shadow:
        0 0 10px
        rgba(67,223,147,.65);
}


.tm-workstation-mode {
    display: flex;

    align-items: center;

    gap: 10px;
}


.tm-workstation-mode label {
    font-size: .74rem;

    opacity: .55;
}


.tm-mode-select {
    min-height: 36px;

    padding:
        7px
        10px;

    border:
        1px solid
        rgba(255,255,255,.09);

    border-radius: 8px;

    background: #0d131c;

    color: inherit;

    outline: none;
}


.tm-mode-select:focus {
    border-color:
        rgba(210,54,121,.55);
}


.tm-mode-status {
    min-width: 150px;

    font-size: .77rem;

    opacity: .62;
}


/* ============================================================
   BARRA CODER
   ============================================================ */

.tm-coder-controls,
.tm-coder-bar {
    flex: 0 0 auto;

    display: flex;

    align-items: end;

    gap: 12px;

    padding:
        10px
        18px;

    background: #101721;

    border-bottom:
        1px solid
        rgba(255,255,255,.07);
}


.tm-coder-controls[hidden],
.tm-coder-bar[hidden] {
    display: none !important;
}


.tm-coder-control,
.tm-coder-field {
    display: grid;

    gap: 5px;
}


.tm-coder-control label,
.tm-coder-field label {
    font-size: .69rem;

    opacity: .55;
}


.tm-coder-status {
    margin-left: auto;

    padding-bottom: 8px;

    font-size: .75rem;

    opacity: .62;
}


/* ============================================================
   ÁREA PRINCIPAL
   ============================================================ */

.tm-ai-workspace {
    flex: 1 1 0;

    min-height: 0;

    height: 100%;

    display: grid;

    grid-template-columns:
        330px
        minmax(0, 1fr);

    overflow: hidden;
}


/* ============================================================
   SIDEBAR DE RECURSOS
   ============================================================ */

.tm-resource-sidebar {
    height: 100%;

    min-height: 0;
    min-width: 0;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    background: #0f151e;

    border-right:
        1px solid
        rgba(255,255,255,.08);
}


.tm-resource-sidebar-header {
    flex: 0 0 auto;

    padding:
        16px
        15px
        11px;
}


.tm-sidebar-title {
    font-size: .94rem;

    font-weight: 700;
}


.tm-sidebar-subtitle {
    margin-top: 3px;

    font-size: .68rem;

    opacity: .45;
}


/* ============================================================
   TABS FICHEIROS / WORKERS / JOBS
   ============================================================ */

.tm-resource-tabs {
    flex: 0 0 auto;

    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 5px;

    padding:
        0
        9px
        9px;

    border-bottom:
        1px solid
        rgba(255,255,255,.06);
}


.tm-resource-tab {
    min-width: 0;

    padding:
        8px
        4px;

    border:
        1px solid
        transparent;

    border-radius: 8px;

    background: transparent;

    color: inherit;

    font-size: .69rem;

    cursor: pointer;
}


.tm-resource-tab:hover {
    background:
        rgba(255,255,255,.05);
}


.tm-resource-tab.is-active {
    background:
        rgba(255,255,255,.075);

    border-color:
        rgba(255,255,255,.08);
}


.tm-resource-tab-panel {
    display: none;

    flex: 1 1 0;

    min-height: 0;

    overflow: hidden;
}


.tm-resource-tab-panel.is-active {
    display: flex;

    flex-direction: column;
}


/* ============================================================
   EXPLORADOR
   ============================================================ */

.tm-resource-explorer,
.tm-resource-explorer[open] {
    flex: 1 1 0;

    height: 100%;

    min-height: 0;

    margin: 0;

    display: flex;

    flex-direction: column;

    overflow: hidden;

    border: 0;

    border-radius: 0;

    background: transparent;
}


.tm-resource-summary {
    display: none !important;
}


/* ============================================================
   1 — SELECIONADO
   ============================================================ */

.tm-resource-selection,
.tm-resource-selected {
    order: 1;

    flex: 0 0 auto;

    padding:
        10px
        11px
        7px;

    background:
        rgba(255,255,255,.018);

    border-bottom:
        1px solid
        rgba(255,255,255,.045);
}


.tm-resource-label,
.tm-resource-selected-label {
    margin-bottom: 5px;

    font-size: .62rem;

    line-height: 1;

    text-transform: uppercase;

    letter-spacing: .055em;

    opacity: .43;
}


.tm-resource-selection code,
.tm-resource-selected code {
    display: block;

    width: 100%;

    max-height: 48px;

    padding:
        7px
        8px;

    overflow-y: auto;
    overflow-x: hidden;

    border-radius: 7px;

    background:
        rgba(0,0,0,.23);

    font-size: .7rem;

    line-height: 1.35;

    overflow-wrap: anywhere;
}


.tm-resource-selected-type {
    margin-top: 4px;

    font-size: .67rem;

    opacity: .48;
}


/* ============================================================
   2 — BOTÕES CHAT / CODER / WORKER
   ============================================================ */

.tm-resource-selection-actions {
    order: 2;

    flex: 0 0 auto;

    display: grid;

    grid-template-columns:
        repeat(3, minmax(0,1fr));

    gap: 5px;

    padding:
        7px
        10px
        10px;

    background:
        rgba(255,255,255,.018);

    border-bottom:
        1px solid
        rgba(255,255,255,.065);
}


.tm-resource-action {
    min-width: 0;

    min-height: 34px;

    padding:
        6px
        5px;

    border:
        1px solid
        rgba(255,255,255,.085);

    border-radius: 8px;

    background:
        rgba(255,255,255,.035);

    color: inherit;

    font-size: .68rem;

    line-height: 1.15;

    cursor: pointer;
}


.tm-resource-action:hover:not(:disabled) {
    background:
        rgba(255,255,255,.09);
}


.tm-resource-action:disabled {
    opacity: .3;

    cursor: not-allowed;
}


.tm-resource-worker-button:not(:disabled) {
    border-color:
        rgba(210,54,121,.46);

    background:
        rgba(210,54,121,.11);
}


.tm-resource-worker-button:not(:disabled):hover {
    background:
        rgba(210,54,121,.20);
}


.tm-resource-run {
    background: #cf3678;

    border-color: #cf3678;

    color: #fff;

    font-weight: 650;
}


/* ============================================================
   3 — BOTÕES SUBIR / ATUALIZAR
   ============================================================ */

.tm-resource-toolbar {
    order: 3;

    flex: 0 0 auto;

    display: flex;

    gap: 6px;

    padding:
        9px
        10px
        6px;
}


.tm-resource-tool-button {
    flex: 1 1 0;

    min-height: 32px;

    border:
        1px solid
        rgba(255,255,255,.075);

    border-radius: 7px;

    background:
        rgba(255,255,255,.028);

    color: inherit;

    font-size: .7rem;

    cursor: pointer;
}


.tm-resource-tool-button:hover {
    background:
        rgba(255,255,255,.075);
}


/* ============================================================
   4 — CAMINHO ATUAL
   ============================================================ */

.tm-resource-path,
.tm-resource-path-row {
    order: 4;

    flex: 0 0 auto;

    display: block;

    padding:
        5px
        10px
        9px;
}


.tm-resource-path > .tm-resource-label,
.tm-resource-path-row > span {
    display: block;

    margin-bottom: 5px;

    font-size: .61rem;

    text-transform: uppercase;

    letter-spacing: .05em;

    opacity: .4;
}


.tm-resource-path code,
.tm-resource-path-row code {
    display: block;

    width: 100%;

    max-height: 48px;

    padding:
        7px
        8px;

    overflow-y: auto;
    overflow-x: hidden;

    border-radius: 7px;

    background:
        rgba(0,0,0,.20);

    font-size: .69rem;

    line-height: 1.35;

    overflow-wrap: anywhere;
}


/* ============================================================
   5 — LISTA DE FICHEIROS
   SCROLL INDEPENDENTE
   ============================================================ */

.tm-resource-entries {
    order: 5;

    flex: 1 1 0;

    height: 0;

    min-height: 0;
    max-height: none;

    display: flex;

    flex-direction: column;

    gap: 2px;

    align-content: initial;

    padding:
        5px
        7px
        10px;

    overflow-y: scroll;
    overflow-x: hidden;

    overscroll-behavior: contain;

    scrollbar-width: thin;

    scrollbar-gutter: stable;

    border-top:
        1px solid
        rgba(255,255,255,.045);
}


.tm-resource-entry {
    width: 100%;

    min-width: 0;
    min-height: 34px;

    flex: 0 0 auto;

    display: flex;

    align-items: center;

    gap: 8px;

    padding:
        6px
        8px;

    border: 0;

    border-radius: 7px;

    background: transparent;

    color: inherit;

    text-align: left;

    cursor: pointer;
}


.tm-resource-entry:hover {
    background:
        rgba(255,255,255,.055);
}


.tm-resource-entry.is-selected {
    background:
        rgba(210,54,121,.14);

    outline:
        1px solid
        rgba(210,54,121,.38);

    outline-offset: -1px;
}


.tm-resource-entry-icon {
    width: 20px;

    flex: 0 0 20px;

    text-align: center;
}


.tm-resource-entry-name {
    min-width: 0;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

    font-size: .78rem;
}


/* Chromium */

.tm-resource-entries::-webkit-scrollbar {
    width: 9px;
}


.tm-resource-entries::-webkit-scrollbar-track {
    background:
        rgba(255,255,255,.018);
}


.tm-resource-entries::-webkit-scrollbar-thumb {
    border:
        2px solid
        transparent;

    border-radius: 10px;

    background:
        rgba(255,255,255,.20);

    background-clip:
        padding-box;
}


.tm-resource-entries::-webkit-scrollbar-thumb:hover {
    background:
        rgba(255,255,255,.34);

    background-clip:
        padding-box;
}


/* ============================================================
   WORKERS
   ============================================================ */

.tm-worker-panel {
    flex: 1 1 0;

    height: 0;

    min-height: 0;

    padding:
        13px
        11px;

    overflow-y: auto;
    overflow-x: hidden;

    overscroll-behavior: contain;

    scrollbar-width: thin;
}


.tm-worker-summary,
.tm-resource-node-status {
    margin-bottom: 11px;

    padding:
        8px;

    border-radius: 8px;

    background:
        rgba(255,255,255,.035);

    font-size: .72rem;

    line-height: 1.35;
}


.tm-worker-static-list {
    display: grid;

    gap: 6px;
}


.tm-worker-card {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 10px;

    padding:
        9px;

    border:
        1px solid
        rgba(255,255,255,.06);

    border-radius: 8px;

    background:
        rgba(255,255,255,.024);
}


.tm-worker-card > div {
    min-width: 0;

    display: grid;

    gap: 3px;
}


.tm-worker-card strong {
    font-size: .79rem;
}


.tm-worker-card span {
    font-size: .65rem;

    opacity: .5;
}


.tm-worker-dot {
    width: 8px;
    height: 8px;

    flex: 0 0 auto;

    border-radius: 50%;

    background: #43df93;
}


/* ============================================================
   JOBS
   ============================================================ */

.tm-job-panel {
    flex: 1 1 0;

    height: 0;

    min-height: 0;

    display: flex;

    flex-direction: column;

    gap: 12px;

    padding:
        13px
        11px;

    overflow-y: auto;
    overflow-x: hidden;

    overscroll-behavior: contain;

    scrollbar-width: thin;
}


.tm-job-field {
    display: grid;

    gap: 5px;

    font-size: .69rem;
}


.tm-job-field > span {
    opacity: .5;
}


.tm-job-field
.tm-mode-select {
    width: 100%;
}


.tm-job-result,
.tm-resource-result {
    margin-top: auto;

    padding:
        9px;

    border-radius: 8px;

    background:
        rgba(255,255,255,.03);

    font-size: .7rem;

    line-height: 1.4;

    overflow-wrap: anywhere;
}


/* ============================================================
   ÁREA DIREITA
   ============================================================ */

.tm-conversation-workspace {
    min-width: 0;
    min-height: 0;

    display: flex;

    flex-direction: column;

    overflow: hidden;

    background: #0a0f16;
}


/* ============================================================
   COMPOSITOR
   ============================================================ */

.tm-chat-form,
.tm-composer {
    flex: 0 0 auto;

    margin: 0;

    padding:
        17px
        19px;

    background: #101721;

    border-bottom:
        1px solid
        rgba(255,255,255,.07);
}


.tm-composer-title-row {
    margin-bottom: 9px;
}


.tm-composer-title {
    font-size: .86rem;

    font-weight: 700;
}


.tm-composer-subtitle {
    margin-top: 2px;

    font-size: .66rem;

    opacity: .42;
}


.tm-chat-input,
.tm-composer-input {
    box-sizing: border-box;

    width: 100%;

    min-height: 96px;
    max-height: 220px;

    padding:
        12px
        13px;

    resize: vertical;

    border:
        1px solid
        rgba(255,255,255,.08);

    border-radius: 10px;

    background: #080d13;

    color: inherit;

    outline: none;

    font: inherit;

    line-height: 1.45;
}


.tm-chat-input:focus,
.tm-composer-input:focus {
    border-color:
        rgba(210,54,121,.62);

    box-shadow:
        0 0 0
        2px
        rgba(210,54,121,.08);
}


.tm-chat-form-footer,
.tm-composer-footer {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 12px;

    margin-top: 9px;
}


.tm-chat-hint {
    font-size: .69rem;

    opacity: .45;
}


.tm-send-button {
    min-width: 110px;
}


/* ============================================================
   CABEÇALHO DA CONVERSA
   ============================================================ */

.tm-conversation-header {
    flex: 0 0 auto;

    padding:
        12px
        19px
        10px;

    border-bottom:
        1px solid
        rgba(255,255,255,.045);
}


.tm-conversation-title {
    font-size: .84rem;

    font-weight: 700;
}


.tm-conversation-subtitle {
    margin-top: 2px;

    font-size: .65rem;

    opacity: .4;
}


/* ============================================================
   CONVERSA
   ============================================================ */

.tm-messages,
.tm-conversation-stream {
    flex: 1 1 0;

    min-height: 0;

    height: 0;

    padding:
        16px
        19px
        35px;

    overflow-y: auto;
    overflow-x: hidden;

    overscroll-behavior: contain;

    scrollbar-width: thin;

    scrollbar-gutter: stable;
}


.tm-message {
    box-sizing: border-box;

    max-width: 820px;

    margin-bottom: 10px;
}


.tm-message-user {
    margin-left: auto;
}


.tm-message-assistant {
    margin-right: auto;
}


/* ============================================================
   REVIEW
   ============================================================ */

.tm-review-panel {
    flex: 0 0 auto;

    max-height: 45%;

    overflow-y: auto;
}


.tm-review-panel[hidden] {
    display: none !important;
}


/* ============================================================
   SCROLLBARS
   ============================================================ */

.tm-worker-panel::-webkit-scrollbar,
.tm-job-panel::-webkit-scrollbar,
.tm-messages::-webkit-scrollbar,
.tm-conversation-stream::-webkit-scrollbar {
    width: 8px;
}


.tm-worker-panel::-webkit-scrollbar-thumb,
.tm-job-panel::-webkit-scrollbar-thumb,
.tm-messages::-webkit-scrollbar-thumb,
.tm-conversation-stream::-webkit-scrollbar-thumb {
    border-radius: 10px;

    background:
        rgba(255,255,255,.16);
}


.tm-worker-panel::-webkit-scrollbar-thumb:hover,
.tm-job-panel::-webkit-scrollbar-thumb:hover,
.tm-messages::-webkit-scrollbar-thumb:hover,
.tm-conversation-stream::-webkit-scrollbar-thumb:hover {
    background:
        rgba(255,255,255,.27);
}


/* ============================================================
   ECRÃS GRANDES
   ============================================================ */

@media (min-width: 1500px) {

    .tm-ai-workspace {
        grid-template-columns:
            360px
            minmax(0, 1fr);
    }

}


/* ============================================================
   TABLET
   ============================================================ */

@media (max-width: 1050px) {

    .tm-ai-workspace {
        grid-template-columns:
            285px
            minmax(0, 1fr);
    }


    .tm-mode-status {
        display: none;
    }

}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 760px) {

    .tm-chat-page {
        padding: 6px;
    }


    .tm-chat-shell {
        border-radius: 11px;
    }


    .tm-workstation-header {
        min-height: auto;

        padding:
            11px
            12px;
    }


    .tm-ai-workspace {
        display: flex;

        flex-direction: column;
    }


    .tm-resource-sidebar {
        flex: 0 0 auto;

        height: 42vh;

        max-height: 42vh;

        border-right: 0;

        border-bottom:
            1px solid
            rgba(255,255,255,.08);
    }


    .tm-resource-tab-panel.is-active {
        height: 100%;
    }


    .tm-resource-explorer,
    .tm-resource-explorer[open] {
        height: 100%;
    }


    .tm-conversation-workspace {
        flex: 1 1 0;

        min-height: 0;
    }


    .tm-chat-form,
    .tm-composer {
        padding: 11px;
    }


    .tm-messages,
    .tm-conversation-stream {
        padding:
            11px
            11px
            25px;
    }


    .tm-coder-controls,
    .tm-coder-bar {
        flex-wrap: wrap;
    }

}


/* ============================================================
   TELEFONE
   ============================================================ */

@media (max-width: 520px) {

    .tm-workstation-mode label,
    .tm-sidebar-subtitle {
        display: none;
    }


    .tm-workstation-header {
        gap: 7px;
    }


    .tm-resource-tabs {
        padding:
            0
            5px
            6px;
    }


    .tm-resource-tab {
        font-size: .64rem;
    }


    .tm-resource-selection-actions {
        grid-template-columns:
            repeat(3, minmax(0,1fr));
    }


    .tm-resource-action {
        font-size: .62rem;
    }


    .tm-chat-form-footer,
    .tm-composer-footer {
        flex-direction: column;

        align-items: stretch;
    }


    .tm-send-button {
        width: 100%;
    }


    .tm-message {
        max-width: 100%;
    }

}



/* ============================================================
   TM01GPT — FILE EXPLORER DIV
   ============================================================ */


/* Painel Ficheiros */
.tm-resource-tab-panel[data-resource-panel="files"].is-active {
    display: flex !important;

    flex-direction: column !important;

    flex: 1 1 0 !important;

    min-height: 0 !important;
    height: 100% !important;

    overflow: hidden !important;
}


/* Contentor real — agora DIV, sem comportamento especial */
#resource-explorer.tm-resource-explorer {
    display: flex !important;

    flex-direction: column !important;

    flex: 1 1 0 !important;

    width: 100% !important;
    height: 100% !important;

    min-height: 0 !important;

    margin: 0 !important;
    padding: 0 !important;

    overflow: hidden !important;

    border: 0 !important;
    border-radius: 0 !important;

    background: transparent !important;
}


/* ============================================================
   TOPO FIXO
   ============================================================ */

#resource-explorer
.tm-resource-selection {
    flex: 0 0 auto !important;

    order: 1 !important;
}


#resource-explorer
.tm-resource-selection-actions {
    flex: 0 0 auto !important;

    order: 2 !important;
}


#resource-explorer
.tm-resource-toolbar {
    flex: 0 0 auto !important;

    order: 3 !important;
}


#resource-explorer
.tm-resource-path {
    flex: 0 0 auto !important;

    order: 4 !important;
}


/* ============================================================
   CONTEÚDO — RESTO TOTAL DA ALTURA
   ============================================================ */

#resource-explorer
.tm-resource-files-area {
    order: 5 !important;

    flex: 1 1 0 !important;

    min-height: 0 !important;

    height: auto !important;

    display: flex !important;

    flex-direction: column !important;

    overflow: hidden !important;

    border-top:
        1px solid rgba(255,255,255,.055) !important;
}


#resource-explorer
.tm-resource-files-title {
    flex: 0 0 auto !important;

    padding:
        8px
        11px
        6px !important;

    font-size: .62rem !important;

    text-transform: uppercase !important;

    opacity: .43 !important;

    border-bottom:
        1px solid rgba(255,255,255,.04) !important;
}


/* ============================================================
   LISTA COM SCROLL
   ============================================================ */

#resource-entries.tm-resource-entries {
    flex: 1 1 0 !important;

    width: 100% !important;

    height: auto !important;

    min-height: 0 !important;
    max-height: none !important;

    box-sizing: border-box !important;

    display: flex !important;

    flex-direction: column !important;

    align-items: stretch !important;

    gap: 2px !important;

    padding:
        5px
        7px
        12px !important;

    margin: 0 !important;

    overflow-y: scroll !important;
    overflow-x: hidden !important;

    overscroll-behavior: contain !important;

    scrollbar-width: thin !important;

    scrollbar-gutter: stable !important;

    border: 0 !important;

    background:
        rgba(0,0,0,.025) !important;
}


/* Cada pasta/ficheiro é uma linha */
#resource-entries
.tm-resource-entry {
    flex:
        0
        0
        34px !important;

    display: flex !important;

    align-items: center !important;

    width: 100% !important;

    min-width: 0 !important;
    min-height: 34px !important;

    box-sizing: border-box !important;

    gap: 8px !important;

    padding:
        6px
        8px !important;

    margin: 0 !important;

    border: 0 !important;

    border-radius: 7px !important;

    background:
        transparent !important;

    color: inherit !important;

    text-align: left !important;

    cursor: pointer !important;
}


#resource-entries
.tm-resource-entry:hover {
    background:
        rgba(255,255,255,.06) !important;
}


#resource-entries
.tm-resource-entry.is-selected {
    background:
        rgba(210,54,121,.14) !important;

    outline:
        1px solid
        rgba(210,54,121,.42) !important;

    outline-offset:
        -1px !important;
}


#resource-entries
.tm-resource-entry-icon {
    flex: 0 0 20px !important;

    width: 20px !important;

    text-align: center !important;
}


#resource-entries
.tm-resource-entry-name {
    flex: 1 1 auto !important;

    min-width: 0 !important;

    overflow: hidden !important;

    white-space: nowrap !important;

    text-overflow: ellipsis !important;

    font-size: .76rem !important;
}


/* ============================================================
   SCROLLBAR
   ============================================================ */

#resource-entries::-webkit-scrollbar {
    width: 10px !important;
}


#resource-entries::-webkit-scrollbar-track {
    background:
        rgba(255,255,255,.02) !important;
}


#resource-entries::-webkit-scrollbar-thumb {
    border:
        2px solid transparent !important;

    border-radius:
        10px !important;

    background:
        rgba(255,255,255,.25) !important;

    background-clip:
        padding-box !important;
}


#resource-entries::-webkit-scrollbar-thumb:hover {
    background:
        rgba(255,255,255,.42) !important;

    background-clip:
        padding-box !important;
}



/* ============================================================
   TM01GPT — WORKSPACE 3 COLUNAS
   Recursos | Conversa | Conversas/Projectos
   ============================================================ */

.tm-ai-workspace {
    grid-template-columns:
        330px
        minmax(0, 1fr)
        270px !important;
}


/* ============================================================
   SIDEBAR DIREITA
   ============================================================ */

.tm-workspace-sidebar {
    min-width: 0;
    min-height: 0;

    height: 100%;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    background:
        #0f151e;

    border-left:
        1px solid
        rgba(255,255,255,.08);
}


.tm-right-sidebar-header {
    flex: 0 0 auto;

    padding:
        16px
        14px
        10px;
}


.tm-right-sidebar-title {
    font-size: .88rem;

    font-weight: 700;
}


.tm-right-sidebar-subtitle {
    margin-top: 3px;

    font-size: .66rem;

    opacity: .42;
}


/* ============================================================
   NOVO CHAT
   ============================================================ */

.tm-new-chat-button {
    flex: 0 0 auto;

    width:
        calc(100% - 20px);

    min-height: 38px;

    margin:
        0
        10px
        10px;

    border:
        1px solid
        rgba(210,54,121,.52);

    border-radius: 8px;

    background:
        rgba(210,54,121,.12);

    color: inherit;

    font-weight: 650;

    font-size: .74rem;

    cursor: pointer;
}


.tm-new-chat-button:hover {
    background:
        rgba(210,54,121,.22);
}


/* ============================================================
   TABS DIREITA
   ============================================================ */

.tm-right-tabs {
    flex: 0 0 auto;

    display: grid;

    grid-template-columns:
        1fr
        1fr;

    gap: 5px;

    padding:
        0
        10px
        10px;

    border-bottom:
        1px solid
        rgba(255,255,255,.06);
}


.tm-right-tab {
    min-height: 32px;

    border:
        1px solid
        transparent;

    border-radius: 7px;

    background:
        transparent;

    color: inherit;

    font-size: .68rem;

    cursor: pointer;
}


.tm-right-tab:hover {
    background:
        rgba(255,255,255,.045);
}


.tm-right-tab.is-active {
    background:
        rgba(255,255,255,.075);

    border-color:
        rgba(255,255,255,.08);
}


/* ============================================================
   PAINÉIS
   ============================================================ */

.tm-right-panel {
    display: none;

    flex: 1 1 0;

    min-height: 0;

    overflow: hidden;
}


.tm-right-panel.is-active {
    display: flex;

    flex-direction: column;
}


/* ============================================================
   LISTA DE CONVERSAS
   ============================================================ */

.tm-conversation-list {
    flex: 1 1 0;

    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    padding:
        7px
        7px
        12px;

    scrollbar-width: thin;
}


.tm-conversation-list-item {
    width: 100%;

    min-width: 0;

    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 8px;

    margin-bottom: 3px;

    padding:
        8px
        8px;

    border:
        1px solid
        transparent;

    border-radius: 7px;

    background:
        transparent;

    color: inherit;

    text-align: left;

    cursor: pointer;
}


.tm-conversation-list-item:hover {
    background:
        rgba(255,255,255,.045);
}


.tm-conversation-list-item.is-active {
    background:
        rgba(210,54,121,.11);

    border-color:
        rgba(210,54,121,.28);
}


.tm-conversation-list-main {
    flex: 1 1 auto;

    min-width: 0;
}


.tm-conversation-list-title {
    overflow: hidden;

    white-space: nowrap;

    text-overflow: ellipsis;

    font-size: .72rem;
}


.tm-conversation-list-meta {
    margin-top: 3px;

    font-size: .61rem;

    opacity: .38;
}


.tm-conversation-delete {
    flex: 0 0 auto;

    width: 20px;
    height: 20px;

    display: grid;

    place-items: center;

    border-radius: 5px;

    opacity: 0;

    font-size: .9rem;
}


.tm-conversation-list-item:hover
.tm-conversation-delete {
    opacity: .45;
}


.tm-conversation-delete:hover {
    opacity: 1 !important;

    background:
        rgba(255,255,255,.08);
}


/* ============================================================
   PROJECTOS
   ============================================================ */

.tm-project-sidebar-actions {
    flex: 0 0 auto;

    padding:
        10px;
}


.tm-project-open-all {
    display: block;

    padding:
        9px
        10px;

    border:
        1px solid
        rgba(255,255,255,.07);

    border-radius: 8px;

    background:
        rgba(255,255,255,.025);

    color: inherit;

    text-decoration: none;

    font-size: .7rem;
}


.tm-project-open-all:hover {
    background:
        rgba(255,255,255,.065);
}


.tm-project-list {
    flex: 1 1 0;

    min-height: 0;

    overflow-y: auto;

    padding:
        0
        8px
        12px;
}


.tm-project-sidebar-card {
    display: flex;

    gap: 9px;

    align-items: center;

    padding:
        9px;

    border:
        1px solid
        rgba(255,255,255,.06);

    border-radius: 8px;

    background:
        rgba(255,255,255,.025);
}


.tm-project-sidebar-icon {
    font-size: 1rem;
}


.tm-project-sidebar-card > div:last-child {
    display: grid;

    min-width: 0;

    gap: 3px;
}


.tm-project-sidebar-card strong {
    font-size: .72rem;
}


.tm-project-sidebar-card span {
    font-size: .62rem;

    opacity: .45;
}


.tm-right-empty {
    padding: 15px;

    text-align: center;

    font-size: .69rem;

    opacity: .45;
}


/* ============================================================
   ECRÃ GRANDE
   ============================================================ */

@media (min-width: 1550px) {

    .tm-ai-workspace {
        grid-template-columns:
            350px
            minmax(0,1fr)
            300px !important;
    }

}


/* ============================================================
   LAPTOP
   ============================================================ */

@media (max-width: 1200px) {

    .tm-ai-workspace {
        grid-template-columns:
            280px
            minmax(0,1fr)
            230px !important;
    }

}


/* ============================================================
   TABLET
   Ocultar sidebar direita
   ============================================================ */

@media (max-width: 950px) {

    .tm-ai-workspace {
        grid-template-columns:
            270px
            minmax(0,1fr) !important;
    }


    .tm-workspace-sidebar {
        display: none;
    }

}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 760px) {

    .tm-ai-workspace {
        display: flex !important;

        flex-direction: column;
    }

}



/* ============================================================
   ACTIVE CONVERSATION ROOT
   ============================================================ */

.tm-composer-title-row {
    display: flex;

    align-items: flex-start;
    justify-content: space-between;

    gap: 12px;
}


.tm-active-root {
    min-width: 0;

    max-width: 55%;

    padding:
        6px
        8px;

    border:
        1px solid
        rgba(210,54,121,.28);

    border-radius: 7px;

    background:
        rgba(210,54,121,.08);

    font-size: .66rem;

    line-height: 1.3;

    overflow: hidden;

    white-space: nowrap;

    text-overflow: ellipsis;
}


.tm-active-root span {
    opacity: .6;
}


.tm-active-root code {
    font: inherit;

    color: inherit;

    opacity: .9;
}


@media (max-width: 760px) {

    .tm-composer-title-row {
        display: block;
    }


    .tm-active-root {
        max-width: 100%;

        margin-top: 7px;
    }

}



/* ============================================================
   ORCHESTRATOR STATUS
   ============================================================ */

.tm-mode-status {
    transition:
        opacity .15s ease;
}


.message-processing {
    opacity: .65;
}


#coder-permission option[value="EDIT"] {
    color: inherit;
}



/* ============================================================
   IDENTIFICAÇÃO DE MENSAGENS
   ============================================================ */

.tm-message {
    display: flex;
    flex-direction: column;

    gap: 6px;

    width: 100%;

    padding:
        12px
        14px;

    box-sizing: border-box;
}


.tm-message-header {
    display: flex;

    align-items: center;

    min-height: 18px;
}


.tm-message-author {
    font-size: .68rem;

    font-weight: 700;

    letter-spacing: .08em;

    text-transform: uppercase;

    opacity: .65;
}


.tm-message-body {
    white-space: pre-wrap;

    overflow-wrap: anywhere;

    line-height: 1.55;
}


/* ------------------------------------------------------------
   UTILIZADOR
   ------------------------------------------------------------ */

.tm-message-user {

    align-items: flex-end;

    text-align: left;
}


.tm-message-user .tm-message-header {

    justify-content: flex-end;
}


.tm-message-user .tm-message-author {

    color: var(
        --tm-accent,
        #d93679
    );
}


.tm-message-user .tm-message-body {

    width: min(
        76%,
        820px
    );

    padding:
        10px
        12px;

    border-radius:
        12px;

    background:
        rgba(
            217,
            54,
            121,
            .10
        );

    border:
        1px solid
        rgba(
            217,
            54,
            121,
            .18
        );
}


/* ------------------------------------------------------------
   TM01GPT
   ------------------------------------------------------------ */

.tm-message-assistant {

    align-items: flex-start;
}


.tm-message-assistant .tm-message-author {

    color: inherit;
}


.tm-message-assistant .tm-message-body {

    width: 100%;
}


/* ------------------------------------------------------------
   MOBILE
   ------------------------------------------------------------ */

@media (
    max-width: 760px
) {

    .tm-message-user .tm-message-body {

        width: 92%;
    }

}



/* ============================================================
   TM01GPT — SESSION STATUS
   ============================================================ */

.tm-session-status {

    display:
        inline-flex;

    align-items:
        center;

    gap:
        7px;

    min-height:
        28px;

    padding:
        4px
        9px;

    border:
        1px solid
        rgba(255,255,255,.09);

    border-radius:
        999px;

    background:
        rgba(255,255,255,.035);

    font-size:
        .68rem;

    font-weight:
        600;

    white-space:
        nowrap;

    user-select:
        none;
}


.tm-session-status-dot {

    display:
        block;

    width:
        7px;

    height:
        7px;

    flex:
        0 0 7px;

    border-radius:
        50%;
}


/* ------------------------------------------------------------
   À espera do utilizador
   ------------------------------------------------------------ */

.tm-session-status-waiting {

    color:
        rgba(220,255,232,.92);

    border-color:
        rgba(69,196,122,.22);

    background:
        rgba(69,196,122,.07);
}


.tm-session-status-waiting
.tm-session-status-dot {

    background:
        #45c47a;

    box-shadow:
        0 0 8px
        rgba(69,196,122,.45);
}


/* ------------------------------------------------------------
   A trabalhar no TM01
   ------------------------------------------------------------ */

.tm-session-status-working {

    color:
        rgba(244,226,255,.96);

    border-color:
        rgba(183,112,255,.28);

    background:
        rgba(183,112,255,.09);
}


.tm-session-status-working
.tm-session-status-dot {

    background:
        #b770ff;

    box-shadow:
        0 0 9px
        rgba(183,112,255,.55);

    animation:
        tm-session-pulse
        1.25s
        ease-in-out
        infinite;
}


/* ------------------------------------------------------------
   Erro
   ------------------------------------------------------------ */

.tm-session-status-error {

    color:
        rgba(255,220,220,.96);

    border-color:
        rgba(235,82,82,.3);

    background:
        rgba(235,82,82,.09);
}


.tm-session-status-error
.tm-session-status-dot {

    background:
        #eb5252;

    box-shadow:
        0 0 8px
        rgba(235,82,82,.48);
}


/* ------------------------------------------------------------
   Pulso discreto apenas quando está a trabalhar
   ------------------------------------------------------------ */

@keyframes tm-session-pulse {

    0%,
    100% {

        opacity:
            .45;

        transform:
            scale(.85);
    }


    50% {

        opacity:
            1;

        transform:
            scale(1.15);
    }
}


@media (
    prefers-reduced-motion:
    reduce
) {

    .tm-session-status-dot {

        animation:
            none !important;
    }
}


/* ------------------------------------------------------------
   Mobile
   ------------------------------------------------------------ */

@media (
    max-width: 760px
) {

    .tm-session-status {

        padding:
            4px
            7px;

        font-size:
            .64rem;
    }

}


/* ============================================================
   RENOMEAR CONVERSAS
   ============================================================ */

.tm-conversation-rename {

    flex:
        0 0 auto;

    width:
        20px;

    height:
        20px;

    display:
        grid;

    place-items:
        center;

    padding:
        0;

    border:
        0;

    border-radius:
        5px;

    background:
        transparent;

    color:
        inherit;

    opacity:
        0;

    font-size:
        .82rem;

    cursor:
        pointer;
}


.tm-conversation-list-item:hover
.tm-conversation-rename {

    opacity:
        .45;
}


.tm-conversation-rename:hover {

    opacity:
        1 !important;

    background:
        rgba(
            255,
            255,
            255,
            .08
        );
}


/* renomear/apagar ficam lado a lado */

.tm-conversation-delete,
.tm-conversation-rename {

    transition:
        opacity .12s ease,
        background .12s ease;
}



/* ============================================================
   ESTADO POR CONVERSA — LISTA LATERAL
   ============================================================ */

.tm-conversation-status-dot {
    flex: 0 0 auto;

    width: 9px;
    height: 9px;

    margin-right: 9px;

    border-radius: 50%;

    align-self: center;
}


/* À espera */
.tm-conversation-status-waiting {
    background: #45c47a;

    box-shadow:
        0 0 8px
        rgba(69,196,122,.45);
}


/* A trabalhar */
.tm-conversation-status-working {
    background: #b770ff;

    box-shadow:
        0 0 9px
        rgba(183,112,255,.55);

    animation:
        tm-session-pulse
        1.25s
        ease-in-out
        infinite;
}


/* Erro */
.tm-conversation-status-error {
    background: #eb5252;

    box-shadow:
        0 0 8px
        rgba(235,82,82,.48);
}


/* ============================================================
   ANEXOS DO COMPOSITOR
   ============================================================ */

.tm-composer-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}


.tm-attachment-button {
    flex: 0 0 auto;
    padding: 7px 11px;
    font-size: .72rem;
}


.tm-attachment-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;

    margin-top: 9px;
    margin-bottom: 2px;

    padding: 8px;

    border:
        1px solid
        rgba(255,255,255,.08);

    border-radius: 10px;

    background:
        rgba(255,255,255,.025);
}


.tm-attachment-preview[hidden] {
    display: none;
}


.tm-attachment-item {
    position: relative;

    display: flex;
    align-items: center;
    gap: 9px;

    box-sizing: border-box;

    min-width: 180px;
    max-width: 310px;

    padding: 7px 32px 7px 7px;

    border:
        1px solid
        rgba(255,255,255,.09);

    border-radius: 9px;

    background:
        rgba(255,255,255,.04);

    overflow: hidden;
}


.tm-attachment-thumbnail {
    display: block;

    width: 48px;
    height: 48px;

    flex: 0 0 48px;

    object-fit: cover;

    border-radius: 7px;

    background:
        rgba(0,0,0,.25);
}


.tm-attachment-file-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 48px;
    height: 48px;

    flex: 0 0 48px;

    border-radius: 7px;

    background:
        rgba(255,255,255,.05);

    font-size: 1.35rem;
}


.tm-attachment-info {
    min-width: 0;
    flex: 1 1 auto;
}


.tm-attachment-name {
    overflow: hidden;

    font-size: .72rem;
    font-weight: 650;

    white-space: nowrap;
    text-overflow: ellipsis;
}


.tm-attachment-meta {
    margin-top: 3px;

    overflow: hidden;

    font-size: .61rem;
    opacity: .48;

    white-space: nowrap;
    text-overflow: ellipsis;
}


.tm-attachment-remove {
    position: absolute;

    top: 5px;
    right: 5px;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 22px;
    height: 22px;

    padding: 0;

    border:
        1px solid
        rgba(255,255,255,.08);

    border-radius: 50%;

    background:
        rgba(0,0,0,.18);

    color: inherit;

    font: inherit;
    font-size: 1rem;
    line-height: 1;

    cursor: pointer;

    opacity: .62;
}


.tm-attachment-remove:hover {
    opacity: 1;

    background:
        rgba(255,255,255,.08);
}


/*
 * Feedback visual durante drag & drop.
 */
.tm-composer.is-dragging-files {
    outline:
        2px dashed
        rgba(210,54,121,.7);

    outline-offset: -5px;

    background:
        rgba(210,54,121,.045);
}


.tm-composer.is-dragging-files::after {
    content: "Largar ficheiros para anexar";

    display: block;

    margin-top: 8px;
    padding: 8px;

    border-radius: 8px;

    text-align: center;

    font-size: .7rem;
    font-weight: 700;

    background:
        rgba(210,54,121,.08);
}


@media (max-width: 760px) {

    .tm-composer-tools {
        width: 100%;
        flex-wrap: wrap;
    }


    .tm-attachment-preview {
        flex-direction: column;
    }


    .tm-attachment-item {
        width: 100%;
        max-width: none;
    }

}


/* ============================================================
   TM01GPT — ESTADO DE SINCRONIZAÇÃO
   ============================================================ */

.tm-sync-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    min-height: 30px;
    padding: 0 10px;

    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 999px;

    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.tm-sync-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.tm-sync-status-pending .tm-sync-status-dot {
    background: #e6a700;
}

.tm-sync-status-ok .tm-sync-status-dot {
    background: #31c46c;
}

.tm-sync-status-error .tm-sync-status-dot {
    background: #e05252;
}

.tm-sync-status-pending .tm-sync-status-text {
    opacity: 0.85;
}

.tm-sync-status-ok .tm-sync-status-text {
    opacity: 1;
}

.tm-sync-status-error .tm-sync-status-text {
    opacity: 1;
}


/* ORIGEM: tm-branding-live.css */
/*
 * TM01GPT — Adaptação ao TM Branding Universal
 * Mantém os estilos específicos fora da biblioteca central.
 */

.tm-branding-active #tm-global-header {
    width: 100%;
}

/* Preservar o menu de autenticação no Header universal */
.tm-branding-active
.tm-global-header
.tm-branding-user-menu {
    display: flex !important;
    align-items: center;
    gap: 10px;
    color: inherit;
    font-size: 13px;
    white-space: nowrap;
}

.tm-branding-active
.tm-global-header
.tm-user-logout {
    color: inherit;
    background: transparent;
    border: 1px solid var(--tm-border, #454550);
}

/* Não interferir com o cabeçalho interno do Chat */
.tm-branding-chat .tm-workstation-header {
    display: flex;
}

@media (max-width: 900px) {
    .tm-branding-active
    .tm-global-header
    .tm-branding-user-menu {
        gap: 6px;
        font-size: 12px;
    }

    .tm-branding-active
    .tm-global-header
    .tm-user-logout {
        padding: 6px 8px;
    }
}

@media (max-width: 480px) {
    .tm-branding-active
    .tm-global-header
    .tm-branding-user-menu > span {
        display: none;
    }
}


/* TM01GPT BRANDING FOOTER FIX V1 */

/* Permitir scroll nas páginas normais com Branding */
html:has(body.tm-branding-active:not(.tm-branding-chat)),
body.tm-branding-active:not(.tm-branding-chat) {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Organizar Header, conteúdo e Footer */
body.tm-branding-active:not(.tm-branding-chat) .tm-app {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    height: auto;
    overflow: visible;
}

/* Remover a altura fixa herdada do Chat */
body.tm-branding-active:not(.tm-branding-chat) .tm-main {
    flex: 1 0 auto;
    height: auto;
    min-height: 0;
    overflow: visible;
}

/* Footer no fim do conteúdo */
body.tm-branding-active:not(.tm-branding-chat) #tm-global-footer {
    display: block;
    flex-shrink: 0;
    width: 100%;
}

/* O Footer nunca deve ficar sobreposto ao conteúdo */
body.tm-branding-active:not(.tm-branding-chat) .tm-global-footer {
    position: relative;
}


/* TM01GPT DASHBOARD CONTRAST V1 */

/* Fundo e texto da página inicial */
body.tm-branding-active:not(.tm-branding-chat) {
    background: #0d1117;
    color: #f5f5f7;
}

/* Variáveis específicas do tema */
body.tm-branding-active:not(.tm-branding-chat) {
    --tm-bg: #0d1117;
    --tm-panel: #151920;
    --tm-text: #f5f5f7;
    --tm-muted: #b8bec9;
    --tm-soft: #d1d5db;
    --tm-border: #343a46;
    --tm-accent: #e62ca6;
}

/* Conteúdo principal */
body.tm-branding-active:not(.tm-branding-chat) .tm-main {
    background: #0d1117;
    color: #f5f5f7;
}

/* Títulos e textos */
body.tm-branding-active:not(.tm-branding-chat) .tm-main h1,
body.tm-branding-active:not(.tm-branding-chat) .tm-main h2,
body.tm-branding-active:not(.tm-branding-chat) .tm-main h3,
body.tm-branding-active:not(.tm-branding-chat) .tm-main strong {
    color: #ffffff;
}

/* Cartões */
body.tm-branding-active:not(.tm-branding-chat) .tm-card {
    background: #151920;
    color: #f5f5f7;
    border-color: #343a46;
}

/* Texto secundário */
body.tm-branding-active:not(.tm-branding-chat) .tm-muted {
    color: #b8bec9;
}


/* TM01GPT CHAT CONTRAST V1 */

/* Paleta específica do Chat */
body.tm-branding-active.tm-branding-chat {
    --tm-bg: #0d1117;
    --tm-panel: #151920;
    --tm-text: #f5f5f7;
    --tm-muted: #b8bec9;
    --tm-soft: #d1d5db;
    --tm-border: #343a46;
    --tm-accent: #e62ca6;

    background: #0d1117;
    color: #f5f5f7;
}

/* Área principal */
body.tm-branding-chat .tm-main,
body.tm-branding-chat .tm-chat-shell {
    color: #f5f5f7;
}

/* Títulos */
body.tm-branding-chat .tm-main h1,
body.tm-branding-chat .tm-main h2,
body.tm-branding-chat .tm-main h3,
body.tm-branding-chat .tm-main h4,
body.tm-branding-chat .tm-main strong {
    color: #ffffff;
}

/* Texto dos painéis */
body.tm-branding-chat .tm-chat-shell,
body.tm-branding-chat .tm-chat-shell section,
body.tm-branding-chat .tm-chat-shell aside {
    color: #f5f5f7;
}

/* Texto secundário */
body.tm-branding-chat .tm-muted,
body.tm-branding-chat .tm-workstation-status,
body.tm-branding-chat .tm-workstation-subtitle {
    color: #b8bec9;
}

/* Campos de escrita */
body.tm-branding-chat textarea,
body.tm-branding-chat input,
body.tm-branding-chat select {
    color: #f5f5f7;
}

/* Texto de ajuda nos campos */
body.tm-branding-chat textarea::placeholder,
body.tm-branding-chat input::placeholder {
    color: #929ba9;
}

/* Links */
body.tm-branding-chat .tm-main a {
    color: #e6e8ed;
}

/* Manter os destaques magenta */
body.tm-branding-chat .tm-main button:hover,
body.tm-branding-chat .tm-main a:hover {
    border-color: #e62ca6;
}


/* ORIGEM: tm-branding-blue.css */
/* TM01GPT — Identidade Azul e Branco */

body.tm-branding-active {
    --tm-accent: #00b8f5;
    --tm-accent-hover: #39ceff;
    --tm-bg: #07111f;
    --tm-panel: #12243a;
    --tm-text: #ffffff;
    --tm-muted: #b9cde0;
    --tm-soft: #dceaf6;
    --tm-border: #29425c;

    --tm-header-bg: #0b1728;
    --tm-header-text: #ffffff;
}

/* Header universal */
body.tm-branding-active .tm-global-header {
    background: #0b1728;
    color: #ffffff;
    border-bottom-color: #29425c;
}

body.tm-branding-active .tm-global-nav .is-active {
    color: #00b8f5;
}

/* Fundo e textos */
body.tm-branding-active,
body.tm-branding-active .tm-main {
    background-color: #07111f;
    color: #ffffff;
}

body.tm-branding-active .tm-main h1,
body.tm-branding-active .tm-main h2,
body.tm-branding-active .tm-main h3,
body.tm-branding-active .tm-main h4,
body.tm-branding-active .tm-main strong {
    color: #ffffff;
}

/* Elementos interativos */
body.tm-branding-active .tm-main button,
body.tm-branding-active .tm-main input,
body.tm-branding-active .tm-main textarea,
body.tm-branding-active .tm-main select {
    accent-color: #00b8f5;
}

/* Destaques azuis em elementos selecionados */
body.tm-branding-active .tm-main .is-active,
body.tm-branding-active .tm-main .is-selected,
body.tm-branding-active .tm-main [aria-selected="true"] {
    border-color: #00b8f5;
}

/* Footer universal */
body.tm-branding-active .tm-global-footer {
    background: #0b1728;
    color: #ffffff;
    border-top-color: #29425c;
}


/* ORIGEM: tm-mobile.css */
/*
 * TM01GPT — Mobile Branding
 * Identidade visual herdada do TM Branding universal.
 * Não substitui os componentes globais.
 */

@media (max-width: 1024px) {

    main,
    section,
    article {
        min-width: 0;
    }

    img,
    video,
    canvas {
        max-width: 100%;
    }

    pre {
        max-width: 100%;
        overflow-x: auto;
    }
}

@media (max-width: 760px) {

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

    *,
    *::before,
    *::after {
        box-sizing: border-box;
    }

    body {
        max-width: 100%;
        margin: 0;
    }

    main,
    section,
    article,
    form {
        min-width: 0;
        max-width: 100%;
    }

    input,
    textarea,
    select {
        max-width: 100%;
        font-family: inherit;
        font-size: 16px;
    }

    button {
        font-family: inherit;
        touch-action: manipulation;
    }

    img,
    video,
    iframe {
        max-width: 100%;
    }

    pre {
        max-width: 100%;
        overflow-x: auto;
        white-space: pre;
        -webkit-overflow-scrolling: touch;
    }

    code {
        overflow-wrap: anywhere;
    }

    table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    td,
    th {
        overflow-wrap: anywhere;
    }

    :where(
        button,
        a,
        input,
        select,
        textarea
    ):focus-visible {
        outline: 2px solid var(
            --tm-accent,
            currentColor
        );
        outline-offset: 2px;
    }
}

@media (max-width: 380px) {

    h1,
    h2,
    h3 {
        overflow-wrap: anywhere;
    }
}

@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }
}

/* ==========================================
   TM01GPT MOBILE — BRANDING UNIVERSAL
   ========================================== */

@media (max-width: 760px) {

    :root {
        --tm-mobile-gap: var(--tm-space-3, 12px);
        --tm-mobile-padding: var(--tm-space-4, 16px);
        --tm-mobile-radius: var(--tm-radius-lg, 12px);
    }

    body {
        font-family: var(
            --tm-font-family,
            Arial,
            sans-serif
        );
        -webkit-tap-highlight-color: transparent;
    }

    /* Conteúdo adaptável */

    :where(main, section, article) {
        min-width: 0;
    }

    :where(
        .container,
        .content,
        .page-content,
        .main-content,
        .dashboard,
        .settings-container,
        .projects-container,
        .tools-container
    ) {
        max-width: 100%;
        min-width: 0;
    }

    /* Cartões e painéis */

    :where(
        .card,
        .panel,
        .dashboard-card,
        .project-card,
        .tool-card,
        .settings-card
    ) {
        min-width: 0;
        max-width: 100%;
        border-radius: var(--tm-mobile-radius);
    }

    /* Grelhas responsivas */

    :where(
        .cards-grid,
        .projects-grid,
        .tools-grid,
        .dashboard-grid,
        .settings-grid
    ) {
        grid-template-columns: minmax(0, 1fr);
    }

    /* Botões compatíveis com toque */

    :where(
        button,
        input[type="submit"],
        input[type="button"],
        .btn,
        .tm-btn
    ) {
        min-height: var(--tm-control-height, 44px);
        max-width: 100%;
        touch-action: manipulation;
    }

    /* Formulários */

    :where(
        input:not([type="checkbox"]):not([type="radio"]),
        textarea,
        select
    ) {
        font-size: 16px;
        min-width: 0;
    }

    /* Navegação: não alterar a lógica dos menus */

    :where(
        nav,
        .navbar,
        .nav-links,
        .tm-nav
    ) {
        max-width: 100%;
    }

    /* Títulos e textos */

    :where(h1, h2, h3, p) {
        overflow-wrap: break-word;
    }

    /* Tabelas e código */

    :where(pre, .code-block, .table-wrapper) {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Foco com cor oficial TM */

    :where(
        a,
        button,
        input,
        select,
        textarea
    ):focus-visible {
        outline: 2px solid var(--tm-brand, #B51783);
        outline-offset: 2px;
    }

}

/* Smartphones compactos */

@media (max-width: 420px) {

    :where(
        .cards-grid,
        .projects-grid,
        .tools-grid,
        .dashboard-grid,
        .settings-grid
    ) {
        gap: var(--tm-space-3, 12px);
    }

    :where(
        .card,
        .panel,
        .dashboard-card,
        .project-card,
        .tool-card
    ) {
        min-width: 0;
    }
}


/* ORIGEM: tm-chat-mobile.css */
/*
 * TM01GPT — Chat Mobile
 * TorrinhaMedia · versão 1
 * Aplicado apenas à página do Chat.
 */

@media (max-width: 760px) {

    /* Estrutura principal */
    .tm-chat-page {
        width: 100%;
        max-width: 100%;
        padding: 8px !important;
        margin: 0 auto;
        box-sizing: border-box;
    }

    .tm-chat-page .tm-chat-shell {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        margin: 0;
        gap: 10px;
    }

    /* Cabeçalho da workstation */
    .tm-chat-page .tm-workstation-header {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 14px !important;
        border-radius: 16px;
    }

    .tm-chat-page .tm-workstation-identity {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px 12px;
        min-width: 0;
    }

    .tm-chat-page .tm-workstation-title {
        width: 100%;
        font-size: 22px !important;
        line-height: 1.2;
        margin: 0;
    }

    .tm-chat-page .tm-workstation-status,
    .tm-chat-page .tm-sync-status,
    .tm-chat-page .tm-mode-status,
    .tm-chat-page .tm-session-status {
        font-size: 12px !important;
        line-height: 1.3;
    }

    .tm-chat-page .tm-sync-status,
    .tm-chat-page .tm-session-status {
        padding: 7px 10px !important;
        max-width: 100%;
    }

    .tm-chat-page .tm-workstation-mode {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        min-width: 0;
    }

    .tm-chat-page .tm-mode-auto {
        font-size: 14px !important;
        margin: 0;
    }

    /* Área de trabalho */
    .tm-chat-page .tm-conversation-workspace {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        gap: 10px;
    }

    /* Formulário */
    .tm-chat-page .tm-chat-form.tm-composer {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 14px !important;
        margin: 0;
        border-radius: 16px;
        box-sizing: border-box;
    }

    .tm-chat-page .tm-composer-title-row {
        margin-bottom: 8px;
    }

    .tm-chat-page .tm-composer-title {
        font-size: 17px !important;
        line-height: 1.3;
    }

    .tm-chat-page .tm-composer-subtitle {
        font-size: 12px !important;
        line-height: 1.4;
    }

    /* Campo de escrita */
    .tm-chat-page #message.tm-composer-input {
        display: block;
        width: 100%;
        min-width: 0;
        min-height: 110px !important;
        height: 110px;
        max-height: 45vh;
        padding: 12px !important;
        margin: 8px 0 12px;
        font-size: 16px !important;
        line-height: 1.5;
        border-radius: 13px;
        box-sizing: border-box;
        resize: vertical;
    }

    /* Botões */
    .tm-chat-page .tm-composer-footer {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
        gap: 10px;
        align-items: start;
        width: 100%;
        min-width: 0;
    }

    .tm-chat-page .tm-composer-tools {
        display: flex;
        flex-direction: column;
        gap: 6px;
        min-width: 0;
        margin: 0;
    }

    .tm-chat-page #tm-attachment-button,
    .tm-chat-page #send-button {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100% !important;
        min-width: 0;
        max-width: 100%;
        height: 50px !important;
        min-height: 50px !important;
        padding: 0 10px !important;
        margin: 0 !important;
        font-size: 15px !important;
        font-weight: 700;
        line-height: 1.2;
        border-radius: 12px;
        box-sizing: border-box;
        white-space: nowrap;
    }

    .tm-chat-page #tm-attachment-button {
        background: #252a35;
        color: #f5f5f7;
        border: 1px solid #454b59;
    }

    .tm-chat-page #send-button {
        background: linear-gradient(
            110deg,
            #b51783,
            #e928a4
        );
        color: white;
        border: 0;
    }

    /* Instruções de teclado dispensáveis no mobile */
    .tm-chat-page .tm-chat-hint {
        display: none !important;
    }

    /* Conversa */
    .tm-chat-page .tm-conversation-header {
        padding: 12px 4px;
    }

    .tm-chat-page .tm-conversation-title {
        font-size: 17px !important;
    }

    /* Impedir que conteúdos largos deformem a página */
    .tm-chat-page pre,
    .tm-chat-page code {
        max-width: 100%;
        overflow-wrap: anywhere;
    }
}

@media (max-width: 380px) {
    .tm-chat-page .tm-chat-form.tm-composer {
        padding: 10px !important;
    }

    .tm-chat-page .tm-composer-footer {
        gap: 7px;
    }

    .tm-chat-page #tm-attachment-button,
    .tm-chat-page #send-button {
        font-size: 13px !important;
    }
}


/* CSS EMBUTIDO ORIGINAL */

/* TM01GPT_SYNC_PULSE_233 */

@keyframes tmSyncYellowPulse233 {
    0%, 100% {
        background-color: #facc15;
        box-shadow: 0 0 3px #facc15;
    }

    50% {
        background-color: #ca8a04;
        box-shadow: 0 0 11px #eab308;
    }
}

.tm-sync-status.tm-sync-status-pending
.tm-sync-status-dot {
    animation: tmSyncYellowPulse233
        1.1s ease-in-out infinite !important;
}

.tm-sync-status.tm-sync-status-pending {
    color: #fde68a !important;
    border-color: #a16207 !important;
}

@media (prefers-reduced-motion: reduce) {
    .tm-sync-status.tm-sync-status-pending
    .tm-sync-status-dot {
        animation: none !important;
        background-color: #eab308;
    }
}


/* CSS EMBUTIDO ORIGINAL */

/* TM01GPT_SEND_STATUS_250 */
.tm-send-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    margin-right: 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(128,128,128,.12);
    color: inherit;
    white-space: nowrap;
}
.tm-send-status[data-state="sending"] {
    color: #b7791f;
    background: rgba(245,158,11,.14);
}
.tm-send-status[data-state="sent"] {
    color: #16834b;
    background: rgba(34,197,94,.13);
}
.tm-send-status[data-state="error"] {
    color: #dc2626;
    background: rgba(239,68,68,.12);
}
.tm-send-status[data-state="sending"]
.tm-send-status-icon {
    animation: tm-send-pulse 1s ease-in-out infinite;
}
@keyframes tm-send-pulse {
    50% { opacity: .35; }
}


/* TM01GPT — Layout centralizado */

:root {
    --tm-gpt-history-width: 260px;
    --tm-gpt-chat-max: 900px;
}

.tm-chat-page,
.tm-chat-shell {
    width: 100% !important;
    max-width: none !important;
}

.tm-ai-workspace {
    display: grid !important;
    grid-template-columns:
        var(--tm-gpt-history-width)
        minmax(0, 1fr) !important;
    gap: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
}

#tm-workspace-sidebar {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    overflow-y: auto;
}

.tm-conversation-workspace {
    grid-column: 2 !important;
    grid-row: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    min-width: 0 !important;
    height: calc(100dvh - 160px);
    overflow: hidden;
}

.tm-conversation-header {
    order: 0;
}

#messages {
    order: 1;
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: var(--tm-gpt-chat-max) !important;
    min-height: 0 !important;
    margin-inline: auto !important;
    overflow-y: auto !important;
    padding: 24px clamp(14px, 3vw, 40px) !important;
}

#chat-form {
    order: 2;
    flex: 0 0 auto !important;
    width: calc(100% - 36px) !important;
    max-width: var(--tm-gpt-chat-max) !important;
    margin: 12px auto 18px !important;
}



@media (max-width: 760px) {
    .tm-ai-workspace {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    #tm-workspace-sidebar {
        display: none !important;
    }

    .tm-conversation-workspace {
        grid-column: 1 !important;
        height: calc(100dvh - 125px);
    }

    #chat-form {
        width: calc(100% - 20px) !important;
    }
}

/* TM01GPT_LAYOUT_2602 */

/*
 * Estrutura:
 * 1. Histórico
 * 2. Pedido
 * 3. Conversa
 */

:root {
    --tm-gpt-history-width: 260px;
    --tm-gpt-request-width: 370px;
}

/* Workspace principal */

.tm-ai-workspace {
    display: grid !important;
    grid-template-columns:
        var(--tm-gpt-history-width)
        minmax(0, 1fr) !important;
    gap: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
}

/* Histórico */

#tm-workspace-sidebar {
    grid-column: 1 !important;
    grid-row: 1 !important;
    min-width: 0 !important;
    width: 100% !important;
    overflow-y: auto;
}

/* Área da conversa passa a ter duas colunas */

.tm-conversation-workspace {
    grid-column: 2 !important;
    grid-row: 1 !important;

    display: grid !important;

    grid-template-columns:
        var(--tm-gpt-request-width)
        minmax(0, 1fr) !important;

    grid-template-rows:
        auto minmax(0, 1fr) !important;

    width: 100% !important;
    min-width: 0 !important;
    height: calc(100dvh - 160px) !important;
    overflow: hidden !important;
    gap: 0 !important;
}

/* Pedido — segunda coluna do ecrã */

#chat-form {
    grid-column: 1 !important;
    grid-row: 1 / -1 !important;

    display: flex !important;
    flex-direction: column !important;

    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    min-height: 0 !important;

    margin: 0 !important;
    border-radius: 0 !important;

    overflow-y: auto !important;
    padding: 16px !important;
}

/* Caixa de texto do pedido */

#message {
    width: 100% !important;
    min-height: 120px;
    resize: vertical;
}

/* Cabeçalho do chat */

.tm-conversation-header {
    grid-column: 2 !important;
    grid-row: 1 !important;
    min-width: 0 !important;
}

/* Respostas — terceira coluna */

#messages {
    grid-column: 2 !important;
    grid-row: 2 !important;

    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: 100% !important;

    margin: 0 !important;
    overflow-y: auto !important;

    padding: 24px clamp(16px, 3vw, 46px) !important;
}

/* Recursos continuam secundários */



/* Ecrãs intermédios */

@media (max-width: 1200px) {
    :root {
        --tm-gpt-history-width: 220px;
        --tm-gpt-request-width: 310px;
    }
}

/* Telemóveis */

@media (max-width: 760px) {
    .tm-ai-workspace {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    #tm-workspace-sidebar {
        display: none !important;
    }

    .tm-conversation-workspace {
        grid-column: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        min-height: calc(100dvh - 125px);
        overflow: visible !important;
    }

    .tm-conversation-header {
        order: 0;
    }

    #messages {
        order: 1;
        height: 48dvh !important;
        min-height: 250px !important;
    }

    #chat-form {
        order: 2;
        height: auto !important;
        overflow: visible !important;
    }
}

/* ============================================================
   TM01GPT — SIDEBAR RECURSOS — ALTURA GRID
   Corrige o colapso vertical causado por height: 100%
   numa linha de grid com altura automática.
   ============================================================ */

.tm-resource-sidebar {
    height: auto !important;
    align-self: stretch !important;
}

/* ============================================================
   TM01GPT — WORKSPACE DE TRÊS COLUNAS
   Recursos | Conversas/Projectos | Conversa
   ============================================================ */

@media (min-width: 951px) {
    .tm-ai-workspace {
        display: grid !important;
        grid-template-columns:
            260px
            260px
            minmax(0, 1fr) !important;
        grid-template-rows: minmax(0, 1fr) !important;
        align-items: stretch !important;
    }

    .tm-resource-sidebar {
        grid-column: 1 !important;
        grid-row: 1 !important;
        width: 260px !important;
        height: auto !important;
        min-height: 0 !important;
        align-self: stretch !important;
    }

    #tm-workspace-sidebar {
        grid-column: 2 !important;
        grid-row: 1 !important;
        width: 260px !important;
        height: 100% !important;
        min-height: 0 !important;
    }

    .tm-conversation-workspace {
        grid-column: 3 !important;
        grid-row: 1 !important;
        width: 100% !important;
        min-width: 0 !important;
        height: calc(100dvh - 160px) !important;
    }
}
