* {
    box-sizing: border-box;
}

html {
    font-family: Arial, Helvetica, sans-serif;
    color: #222;
    background: #f4f6f8;
}

body {
    margin: 0;
    min-height: 100vh;
}

a {
    color: inherit;
}

.content {
    width: 100%;
    padding: 120px 12% 20px;
    height:fit-content !important;
    background:transparent !important;
}

.wrapper {
    width: min(1320px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 28px;
    align-items: stretch;
    min-height: 500px;
}

#left,
#right {
    min-width: 0;
    height: 100%;
    background: #fff;
    border: 1px solid #d9dee5;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(20, 32, 45, 0.08);
}

#left {
    display: flex;
    flex-direction: column;
}

.container {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding:0 !important;
    width: fit-content;
}

#titulo_left,
#titulo {
    padding: 16px 18px;
    border-bottom: 1px solid #e3e7ec;
    color: #1f3349;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    background: #f9fafc;
    border-radius: 6px 6px 0 0;
}

.pesq form {
    display: grid;
    gap: 16px;
    max-width: 60%;
    margin: 0 auto;
    padding: 50px 30px;
}

.pesq label {
    display: grid;
    gap: 7px;
    color: #34485f;
    font-size: 14px;
    font-weight: 700;
}

.pesq input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #cfd7e2;
    border-radius: 6px;
    color: #1f2933;
    background: #fff;
    font-size: 15px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pesq input:focus {
    border-color: #2f80ed;
    box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.16);
}

#sub_pesq,
.gen_btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 11px 16px;
    border: 0;
    border-radius: 6px;
    color: #fff;
    background: #1f6fbd;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

#sub_pesq:hover,
.gen_btn:hover {
    background: #195f9f;
}

#sub_pesq:active,
.gen_btn:active {
    transform: translateY(1px);
}

#resultado {
    margin: 25px 20px 20px;
}

#resultado p {
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid #f2b7b7;
    border-radius: 6px;
    color: #9f1d1d;
    background: #fff3f3;
    font-size: 14px;
    line-height: 1.45;
}

#dados_pedido {
    padding: 16px;
    border: 1px solid #dfe6ee;
    border-radius: 8px;
    background: #fbfcfe;
    font-size: 14px;
    line-height: 1.8;
}

.dados-grid {
    display: grid;
    grid-template-columns: minmax(120px, 0.42fr) minmax(0, 1fr);
    gap: 9px 18px;
    padding: 16px;
    border: 1px solid #dfe6ee;
    border-radius: 6px;
    background: #fbfcfe;
    font-size: 14px;
    line-height: 1.45;
}

.dados-grid .linha-dupla {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto minmax(40px, 0.30fr) auto minmax(72px, 1fr);
    gap: 8px 14px;
    align-items: baseline;
    border-bottom: 2px solid #1f3349;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

.dados-grid .rotulo {
    color: #475b70;
    font-weight: 400;
    white-space: nowrap;
    font-size: 12px;
}

.dados-grid .valor {
    min-width: 0;
    color: #1f2933;
    overflow-wrap: anywhere;
}

.dados-grid .valor-tit {
    min-width: 0;
    color: #1f2933;
    overflow-wrap: anywhere;
}

.dados-grid .valor.documento {
    text-transform: uppercase;
}

#tit {
    display: inline-block;
    min-width: 142px;
    margin-right: 6px;
    color: #475b70;
    font-weight: 700;
}

#dados_pedido #tit:nth-of-type(1),
#dados_pedido #tit:nth-of-type(2) {
    min-width: auto;
}

#dados_pedido #tit:nth-of-type(2) {
    margin-left: 22px;
}

#date {
    display: inline-block;
}

#alerta {
    margin-top: 18px;
    padding: 14px;
    border-left: 4px solid #d14b4b;
    border-radius: 6px;
    color: #4f2f2f;
    background: #fff6f2;
    font-size: 13px;
    line-height: 1.5;
}

#buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

#buttons .gen_btn {
    width: 100%;
}

#right {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.conteudo {
    flex: 1;
    padding: 24px;
    background: #eef2f6;
}

.contrato {
    width: 100%;
    min-height: 100%;
    margin: 0 auto;
    padding: 30px;
    border: 1px solid #d8dce2;
    border-radius: 4px;
    color: #1f2933;
    background: #fff;
    box-shadow: 0 10px 28px rgba(20, 32, 45, 0.10);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    line-height: 1.65;
    overflow-wrap: anywhere;
    max-height: 400px;
    overflow-y: auto;
}

.contrato h1,
.contrato h2,
.contrato h3 {
    color: #111827;
    line-height: 1.25;
}

.contrato p {
    font-family: 'Inter', sans-serif;    
    font-size:13px;
    margin: 0 0 14px;
}

.contrato table {
    width: 100%;
    border-collapse: collapse;
}

.contrato td,
.contrato th {
    padding: 8px;
    border: none;
    vertical-align: top;
}

.nova-consulta {
    margin-top: 16px;
}

.btn-nova-consulta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid #d5d5d5;
    border-radius: 6px;
    color: #2462a7;
    background: #d7d7d77a;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    width: 100%;
}

.btn-nova-consulta:hover {
    background: #f4f6f8;
    text-decoration: none;    
}

#icon img {
    margin: 0 5px;
}

@media (max-width: 920px) {
    .content {
        padding: 16px;
    }

    .wrapper {
        grid-template-columns: 1fr;
        align-items: start;
    }

    #left {
        position: static;
        display: block;
    }

    #left,
    #right {
        height: auto;
    }

    .contrato {
        min-height: 620px;
        padding: 30px;
        font-size: 15px;
    }
    .dados-grid {
        display: flex;
        grid-template-columns: minmax(120px, 0.42fr) minmax(0, 1fr);
        gap: 9px 18px;
        padding: 16px;
        border: 1px solid #dfe6ee;
        border-radius: 6px;
        background: #fbfcfe;
        font-size: 14px;
        line-height: 1.45;
        grid-auto-flow: row;
        align-content: center;
        flex-direction: column;
    }    
    main.content {
        width: 100% !important;
        height: fit-content !important;
    }  
    .area-1 {
        height: fit-content;
    }    
    .container_pedido {
        padding: 7% 0% 2% 0%;
        width: 96%;
        margin-left: 2%;
        height: fit-content !important;
    }  
    #titulo {
        width: 100% !important;
        margin-left: 0 !important;
    }    
}

@media (max-width: 520px) {
    .content {
        padding: 10px;
    }

    .container,
    .conteudo {
        padding: 16px;
    }

    #buttons {
        grid-template-columns: 1fr;
    }

    #tit {
        min-width: 118px;
    }

    #dados_pedido #tit:nth-of-type(2) {
        margin-left: 12px;
    }

    .dados-grid {
        grid-template-columns: 128px minmax(0, 1fr);
        gap: 8px 12px;
    }

    .dados-grid .linha-dupla {
        grid-template-columns: 0.3fr 1fr;
        gap: 4px 10px;
    }

    .dados-grid .linha-dupla .rotulo:nth-of-type(2) {
        grid-column: 1;
    }

    .dados-grid .linha-dupla .valor:nth-of-type(2) {
        grid-column: 2;
    }

    .contrato {
        min-height: 520px;
        padding: 20px;
        font-size: 14px;
    }
}

@media print {
    body {
        background: #fff;
    }

    .content {
        padding: 0;
    }

    .wrapper {
        display: block;
        width: 100%;
    }

    #left,
    #titulo {
        display: none;
    }

    #right,
    .contrato {
        border: 0;
        box-shadow: none;
    }

    .conteudo {
        padding: 0;
        background: #fff;
    }
}
