main {
    max-width: none;
    padding: 16px;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.terminal-window {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    border: 1px solid #354155;
    border-radius: 20px;
    background: #191d27;
}

.terminal-heading {
    position: relative;
    isolation: isolate;
    min-height: 118px;
    padding: 24px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    background: linear-gradient(
        105deg,
        #252b38 0%,
        #202b3e 64%,
        #101d38 100%
    );
    border-bottom: 1px solid #354155;
}

.terminal-brand {
    z-index: 1;
    flex: 1;
    min-width: 0;
}

.terminal-heading h1 {
    font-size: 26px;
    letter-spacing: -.6px;
    margin: 0 0 5px;
    line-height: 1.2;
}

.terminal-brand-initials {
    color: #f4f7fc;
}

.terminal-brand-console {
    color: #32c4ef;
}

.terminal-heading small {
    color: #b9c7df;
}

.terminal-mascot {
    position: absolute;
    right: 0px;
    top: -55px;
    width: 330px;
    height: 230px;
    object-fit: contain;
    object-position: center;
    pointer-events: none;
    z-index: 0;
}

.terminal-toolbar,
.terminal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 10px 24px;
    font-size: 12px;
    color: #aab5ca;
    background: #252b38;
}

.terminal-toolbar > div,
.terminal-footer > div {
    display: flex;
    align-items: center;
    gap: 14px;
}

.terminal-actions {
    display: flex;
    align-items: center;
}

.terminal-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 4px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #dbe5f5;
    cursor: pointer;
    transition: color .2s, background .2s;
}

.terminal-icon-button:hover {
    background: rgba(255,255,255,.08);
}

.terminal-icon-button svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.terminal-icon-button.lock-button {
    color: #f6b82a;
}

.copy-button.copied {
    color: #41d58b;
}

.copy-success {
    display: none;
}

.copy-button.copied .copy-default {
    display: none;
}

.copy-button.copied .copy-success {
    display: block;
}

.terminal-viewport {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 22px 24px;
    scrollbar-width: thin;
    cursor: text;
}

.terminal-output {
    font: 13px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
    color: #eef3fb;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.terminal-line {
    display: block;
    min-height: 1.6em;
}

.terminal-line.path {
    color: #39d98a;
}

.terminal-line.command {
    color: #c8d3e2;
}

.terminal-line.result {
    color: #f0f4fa;
}

.terminal-line.error {
    color: #ff8991;
}

.terminal-line.meta {
    color: #a3b4ce;
}

#terminal {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin: 0;
    padding: 0 0 20px;
}

#prompt {
    display: block;
    color: #39d98a;
    font: 13px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
    overflow-wrap: anywhere;
}

#command {
    display: block;
    width: 100%;
    min-height: 1.6em;
    padding: 0;
    margin: 0;
    resize: none;
    border: 0;
    border-radius: 0;
    outline: none;
    box-shadow: none;
    background: transparent;
    color: #c8d3e2;
    font: 13px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
}

#command:focus,
#command:focus-visible {
    outline: none;
    border: 0;
    box-shadow: none;
}

#terminal.execution-active {
    display: none;
}

.terminal-footer {
    background: #191d27;
    min-height: 42px;
}

.terminal-footer button {
    border: 0;
    background: transparent;
    padding: 6px;
    color: #dbe5f5;
    font-size: 12px;
}

#status.status-running {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #e5edf8;
}

#status.status-running::before {
    content: "";
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,255,255,.22);
    border-top-color: #e5edf8;
    border-radius: 50%;
    animation: dn-spin .75s linear infinite;
}

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

#login-message {
    margin: 12px 0;
    color: #ff8991;
    font-size: 13px;
}

.mobile-execute {
    display: none;
}

@media (max-width: 650px) {
    main {
        padding: 8px;
    }

    .terminal-heading {
        padding: 14px;
        min-height: 88px;
    }

    .terminal-heading h1 {
        font-size: 22px;
    }

    .terminal-mascot {
        right: -10px;
        top: -12px;
        width: 145px;
        height: 115px;
        opacity: .8;
    }

    .terminal-brand {
        padding-right: 80px;
    }

    .terminal-toolbar,
    .terminal-viewport {
        padding: 14px;
    }

    .terminal-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .terminal-actions {
        flex-wrap: wrap;
    }

    .mobile-execute {
        display: block;
        margin-top: 12px;
    }

    .terminal-footer {
        flex-wrap: wrap;
        padding: 8px 14px;
    }
}

/* Espaçamento compacto entre comandos */
.terminal-line {
    min-height: 1.45em;
    line-height: 1.45;
}

.terminal-line.path {
    margin-top: 8px;
}

.terminal-line.command {
    margin-top: 0;
    margin-bottom: 4px;
}

.terminal-output {
    line-height: 1.45;
}

/* Entrada com quebra automática e altura dinâmica */
#command {
    display: block;
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 20px;
    max-height: none;

    padding: 0;
    margin: 0;

    box-sizing: border-box;
    resize: none;

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

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

    line-height: 1.45;
}

/* Evita que o formulário force largura horizontal */
#terminal {
    min-width: 0;
}

/* Permite quebra visual no histórico */
#viewport {
    overflow-x: hidden;
}

#viewport .command {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* DN Console — Pesquisa compacta no rodapé */

#terminal-panel {
    position: relative;
}

.dn-search[hidden] {
    display: none !important;
}

.dn-search {
    position: absolute;
    z-index: 50;

    bottom: 7px;
    left: 50%;
    transform: translateX(-50%);

    display: flex;
    align-items: center;
    gap: 7px;

    width: min(400px, calc(100% - 24px));
    height: 25px;
    min-height: 0;
    padding: 0 0 5px 10px;

    box-sizing: border-box;

    color: #e5eaf4;
    background: #202938;
    border: 1px solid #405066;
    border-radius: 999px;

    box-shadow: 0 3px 12px rgba(0, 0, 0, .2);
}

.dn-search-field {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 7px;
    min-width: 0;
    height: 100%;
}

.dn-search-icon {
    flex-shrink: 0;
    color: #8e9bb1;
    font-size: 18px;
    line-height: 1;
    padding: 0 0 5px 0px;
}

.dn-search-input {
    flex: 1;
    width: 100%;
    min-width: 0;
    height: 100%;
    min-height: 0;
    padding: 0;

    background: transparent;
    color: #edf2fa;
    border: 0;
    outline: 0;
    border-radius: 0;

    font: inherit;
    font-size: 12px;
    line-height: normal;
}

.dn-search-input::placeholder {
    color: #8190a6;
}

.dn-search-input::-webkit-search-cancel-button {
    display: none;
}

.dn-search-count {
    flex-shrink: 0;
    min-width: 32px;

    color: #a2aec1;
    font-size: 10px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.dn-search button {
    flex-shrink: 0;
    display: grid;
    place-items: center;

    width: 20px;
    height: 22px;
    padding: 3px 0 0 0;

    color: #ccd6e6;
    background: transparent;
    border: 0;
    border-radius: 50%;

    font: inherit;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

.dn-search button:hover {
    color: #fff;
    background: #354155;
    padding: 3px 0 0 0;
}

/* Destaques dos resultados */

#viewport mark.dn-search-match {
    color: #18202b;
    background: #e4bd55;
    border-radius: 2px;
}

#viewport mark.dn-search-current {
    color: #10221b;
    background: #4ee5a4;
    outline: 1px solid #b4ffe0;
}

/* Telas menores */

@media (max-width: 560px) {
    .dn-search {
        bottom: 6px;
        width: min(360px, calc(100% - 20px));
        height: 30px;
        gap: 4px;
        padding: 0 8px;
    }

    .dn-search-input {
        font-size: 12px;
    }
}

/* Botão de pesquisa na barra superior */

.dn-search-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 30px;
    height: 30px;
    padding: 0;

    color: #c8d6ed;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;

    cursor: pointer;
    transition:
        color 0.15s ease,
        background 0.15s ease,
        border-color 0.15s ease;
}

.dn-search-toggle:hover {
    color: #ffffff;
    background: rgba(72, 166, 238, 0.10);
}

.dn-search-toggle.is-active {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.14);
    border-color: rgba(56, 189, 248, 0.30);
}

.dn-search-toggle:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: 2px;
}

/* Ocultar a barra sem bloquear a rolagem */

#viewport {
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#viewport::-webkit-scrollbar {
    display: none;
}

/* Oculta o botão de cancelar durante a execução */
#cancel {
    display: none !important;
}