:root {
    color-scheme: light;
}

* { box-sizing: border-box; }

body {
    min-height: 100vh;
    margin: 0;
    display: grid;
    place-items: center;
}

main:has(#login-screen:not([hidden])) {
    width: min(100%, 720px);
    padding: clamp(28px, 6vw, 64px);
    border: 1px solid #c0cdbd;
    border-radius: 12px;
    box-shadow: 0 18px 50px rgb(36 57 42 / 12%);
    background: rgba(255,255,255, 0.8);
}

body:has(#content-screen:not([hidden])) {
    display: block;
    padding-top: 88px;
}

body:has(#map-screen:not([hidden])) {
    display: block;
    height: 100vh;
    min-height: 100vh;
    padding: 0;
    overflow: hidden;
}

main:has(#content-screen:not([hidden])) {
    margin: 0 auto;
    width: min(100%, 1200px);
    border: 1px solid #c0cdbd;
    border-radius: 12px;
    box-shadow: 0 18px 50px rgb(36 57 42 / 12%);
    background: rgba(255,255,255, 0.8);
}

main:has(#map-screen:not([hidden])) {
    width: 100vw;
    height: 100vh;
    margin: 0 calc(50% - 50vw);
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

[hidden] { display: none !important; }

.login-container {
    width:100%;
    overflow: hidden;
    margin-bottom: 28px;
}

.login-container .logo {
    float: left;
    width: 50%;
    box-sizing: border-box;
    border-right: 3px dotted #2c669d;
}

.logo img {
    max-width: 65%;
}

.login-container .internal-access {
    color: #101010;
    font-weight: bold;
    font-size: 30px;
    padding: 14px 0;
    text-align: center;
}

#background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url(./../images/chemistry-wallpaper-4-progressive_L.jpg);
    background-repeat: repeat;
    background-attachment: scroll;
    background-size: auto;
    background-attachment: fixed;
    background-size: 100%;
    opacity: 0.1;
    filter: alpha(opacity=10);
    z-index: -1;
}

.actions {
    margin-top: 28px;
    text-align: center;
}

.topbar {
    position: fixed;
    z-index: 10;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    padding: 10px max(24px, calc((100vw - 1440px) / 2 + 24px));
    border-bottom: 1px solid #c0cdbd;
    background: rgba(255,255,255, 0.8);
    box-shadow: 0 5px 20px rgb(36 57 42 / 8%);
    backdrop-filter: blur(12px);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    margin-right: 24px;
}

.nav-link {
    min-height: 40px;
    padding: 0 16px;
    color: #6282B2;
    background: transparent;
    font-size: 0.9rem;
    font-weight: bold;
    border-radius: 12px;
}

.nav-link:hover,
.nav-link.active {
    color: #FFF;
    background: #AFC5D1;
}

.profile {
    position: relative;
}

.avatar {
    display: grid;
    width: 40px;
    min-height: 40px;
    padding: 0;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #6282B2;
    font-size: 1rem;
}

.avatar:hover { background: #406090; }

.profile-menu {
    position: absolute;
    top: 50px;
    right: 0;
    min-width: 190px;
    padding: 8px;
    border: 1px solid #c0cdbd;
    border-radius: 8px;
    background: #fbfcf9;
    box-shadow: 0 12px 30px rgb(36 57 42 / 16%);
}

.profile-menu p {
    overflow: hidden;
    margin: 4px 8px 8px;
    color: #526157;
    font: 0.8rem Arial, sans-serif;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-menu button {
    width: 100%;
    color: #a33126;
    background: transparent;
    text-align: left;
}

.profile-menu button:hover { background: #f6e2df; }

.user-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 22px;
    border-bottom: 1px solid #d7e1d5;
    margin-bottom: 28px;
}

.user-line p { margin: 0; color: #526157; }

#tool-content {
    min-width: 0;
    margin-top: 28px;
}

#map-screen {
    width: 100vw;
    max-width: none;
    height: calc(100vh - 64px);
    min-height: calc(100vh - 64px);
    margin: 78px calc(50% - 50vw) 0;
    background: #f8fafc;
    overflow: hidden;
    display: block;
    padding: 0;
}

#map-container {
    position: relative;
    width: 100vw;
    height: calc(100vh - 64px);
    margin: 0 calc(50% - 50vw);
    overflow: hidden;
    background: #0f172a;
}

#map-screen > * {
    width: 100%;
    height: 100%;
    z-index: 10;
}

#map {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
}

@media (max-width: 640px) {
    body:has(#app-screen:not([hidden])) { padding: 80px 12px 12px; }
    .topbar { padding: 10px 12px; }
    .brand { display: none; }
    .nav-links { margin-left: 0; margin-right: auto; }
    .nav-link { padding: 0 10px; }
}

#message-screen {
    background-color: #eee;
    position: fixed;
    width: 40%;
    text-align: center;
    top: 25%;
    left: 50%;
    padding: 20px;
    transform: translate(-50%, 0);

    border-radius: 10px;
    display: none;
    text-align: center;
    font-weight: bold;
}

#status-message.error { color: #a33126; display:block; }

/* Modal used by showStatus(). Status messages dismiss themselves and never block
   the screen; errors stay until the user closes them and carry the response. */
.status-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgb(16 24 20 / 45%);
    backdrop-filter: blur(2px);
}

.status-modal:not(.error) {
    background: transparent;
    backdrop-filter: none;
    pointer-events: none;
}

.status-modal:not(.error) .status-modal-close { display: none; }

.status-modal-card {
    width: min(100%, 560px);
    max-height: 80vh;
    overflow: auto;
    padding: 20px 22px;
    border: 1px solid #c0cdbd;
    border-top: 4px solid #6282B2;
    border-radius: 12px;
    background: #fbfcf9;
    box-shadow: 0 18px 50px rgb(36 57 42 / 25%);
}

.status-modal.error .status-modal-card { border-top-color: #a33126; }

.status-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.status-modal-badge {
    padding: 4px 10px;
    border-radius: 999px;
    color: #fff;
    background: #6282B2;
    font: bold 0.72rem Arial, sans-serif;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.status-modal.error .status-modal-badge { background: #a33126; }

.status-modal-close {
    width: 32px;
    min-height: 32px;
    padding: 0;
    border-radius: 50%;
    color: #526157;
    background: transparent;
    font-size: 1.3rem;
    line-height: 1;
}

.status-modal-close:hover { color: #a33126; background: #f6e2df; }

.status-modal-message {
    margin: 0;
    color: #24392a;
    font: bold 0.95rem Arial, sans-serif;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.status-modal.error .status-modal-message { color: #a33126; }

.status-modal-details { margin-top: 14px; }

.status-modal-details-title {
    display: block;
    margin-bottom: 6px;
    color: #526157;
    font: bold 0.72rem Arial, sans-serif;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.status-modal-json {
    max-height: 40vh;
    margin: 0;
    padding: 12px;
    overflow: auto;
    border: 1px solid #d7e1d5;
    border-radius: 8px;
    background: #f2f5f1;
    color: #24392a;
    font: 0.78rem/1.45 ui-monospace, Consolas, monospace;
    white-space: pre;
}

/* https://css-loaders.com/spinner/ */
/* Shown by showLoader() while a tool is fetched or a quote is saved. Centered on
   the viewport (inset + margin:auto); not via `transform`, which the spin
   animation owns. */
#loader {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 40;
    width: 30px;
    height: 30px;
    margin: auto;
    padding: 5px;
    pointer-events: none;
    aspect-ratio: 1;
    border-radius: 50%;
    background: #25b09b;
    --_m: 
        conic-gradient(#0000 10%,#000),
        linear-gradient(#000 0 0) content-box;
    -webkit-mask: var(--_m);
            mask: var(--_m);
    -webkit-mask-composite: source-out;
            mask-composite: subtract;
    animation: l3 1s infinite linear;
}
@keyframes l3 {to{transform: rotate(1turn)}}

/* /samuel */
.monitor-card { 
    background: white; 
    padding: 30px; 
    border-radius: 12px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    display: inline-block; width: 100%; max-width: 420px; 
    transition: all 0.4s ease; 
}

.indicador-v { 
    font-size: 1.4rem; 
    font-weight: bold; 
    margin: 15px 0; 
}

.info-detalhe { 
    font-size: 1rem; 
    color: #4b5563; 
    margin: 8px 0; 
}