:root {
    --porto-blue: #003087;
    --porto-blue-light: #0046b8;
    --porto-cyan: #00adef;
    --bg: #f4f7fb;
    --text: #1a2b3c;
    --muted: #5a6a7a;
    --ok: #1b7f4a;
    --warn: #b45309;
    --erro: #b42318;
    --card: #fff;
    --radius: 12px;
    --shadow: 0 8px 30px rgba(0, 24, 80, .08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container { width: min(1100px, 92%); margin: 0 auto; }

.topbar {
    background: linear-gradient(90deg, var(--porto-blue), var(--porto-blue-light));
    color: #fff;
    padding: 1rem 0;
}

.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
}

.brand small { font-weight: 400; opacity: .85; }

.brand-mark {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: var(--porto-cyan);
    display: grid; place-items: center;
    font-weight: 800;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: .85rem;
    font-size: .9rem;
}
.topbar-nav a { color: #fff; text-decoration: none; opacity: .9; }
.topbar-nav a:hover { opacity: 1; text-decoration: underline; }

.term-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: flex-start;
}
.term-layout {
    display: grid;
    grid-template-columns: minmax(200px, 240px) 1fr;
    gap: 1rem;
    align-items: start;
}
.term-files {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: .35rem;
    max-height: 70vh;
    overflow: auto;
}
.term-file {
    display: block;
    padding: .45rem .6rem;
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    font-size: .8rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.term-file small { display: block; color: var(--muted); font-family: inherit; }
.term-file:hover, .term-file.is-active { background: #eef4ff; color: var(--porto-blue); }

.term {
    background: #0b1220;
    color: #d7e3f4;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    min-height: 420px;
}
.term-bar {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem .85rem;
    background: #121a2b;
    border-bottom: 1px solid #243049;
}
.term-dot { width: 10px; height: 10px; border-radius: 50%; background: #3d4d66; }
.term-dot:nth-child(1) { background: #ff5f56; }
.term-dot:nth-child(2) { background: #ffbd2e; }
.term-dot:nth-child(3) { background: #27c93f; }
.term-title { margin-left: .5rem; font-size: .75rem; color: #8ea0b8; font-family: ui-monospace, Menlo, monospace; }
.term-body { padding: 1rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; line-height: 1.45; }
.term-call { margin: 1rem 0 1.5rem; padding-top: .75rem; border-top: 1px dashed #243049; }
.term-call:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.term-line { margin: .2rem 0; word-break: break-word; }
.term-prompt { color: #27c93f; }
.term-comment, .term-muted { color: #6b7c93; }
.term-ok { color: #4ade80; }
.term-warn { color: #fbbf24; }
.term-err { color: #f87171; }
.term-code {
    display: inline-block;
    background: #3f1d20;
    color: #fca5a5;
    padding: 0 .35rem;
    border-radius: 4px;
    font-weight: 700;
}
.term-pane { margin: .55rem 0 0; background: #071018; border: 1px solid #1c2a40; border-radius: 8px; }
.term-pane-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .35rem .7rem;
    color: #8ea0b8;
    font-size: .72rem;
    border-bottom: 1px solid #1c2a40;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.term-copy {
    background: transparent;
    border: 1px solid #3d4d66;
    color: #c5d4e8;
    border-radius: 4px;
    padding: .15rem .45rem;
    cursor: pointer;
    font: inherit;
    font-size: .7rem;
}
.term-copy:hover { border-color: var(--porto-cyan); color: #fff; }
.term pre {
    margin: 0;
    background: transparent;
    color: #e2e8f0;
    max-height: 280px;
    font-size: .72rem;
}

.hml-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    background: #0b1220;
    color: #d7e3f4;
    border-top: 1px solid #243049;
}
body.hml-has-dock { padding-bottom: 3.25rem; }
.hml-dock-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
    padding: .7rem 0;
    color: inherit;
    text-decoration: none;
    font-size: .85rem;
}
.hml-dock-bar strong { color: #67e8f9; }
.hml-dock-open { margin-left: auto; color: #8ea0b8; }

body { padding-bottom: 0; }

@media (max-width: 800px) {
    .term-layout { grid-template-columns: 1fr; }
    .term-files { max-height: 180px; }
}

.main { flex: 1; padding: 2rem 0 3rem; }

.footer {
    background: #e8edf5;
    color: var(--muted);
    font-size: .85rem;
    padding: 1.25rem 0;
    text-align: center;
}

.hero {
    background: linear-gradient(135deg, var(--porto-blue) 0%, #001f5c 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 3rem 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.hero h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-bottom: .75rem; }
.hero p { opacity: .9; max-width: 55ch; margin-bottom: 1.5rem; }

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
}

.card h3 { color: var(--porto-blue); margin-bottom: .5rem; }

.card-info { border-left: 4px solid var(--porto-cyan); }
.card-warn { border-left: 4px solid var(--warn); background: #fff8eb; }

.page-head { margin-bottom: 1.5rem; }
.page-head h1 { color: var(--porto-blue); font-size: 1.75rem; }
.page-head p { color: var(--muted); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .7rem 1.25rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    font-size: .95rem;
}

.btn-primary { background: var(--porto-cyan); color: #fff; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; border: 1px solid #c5d0e0; color: var(--text); }
.btn-block { width: 100%; }

.form { display: flex; flex-direction: column; gap: 1.25rem; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.field { display: flex; flex-direction: column; gap: .35rem; }
.field span { font-size: .85rem; font-weight: 600; color: var(--muted); }
.field input, .field select {
    padding: .65rem .75rem;
    border: 1px solid #cfd8e6;
    border-radius: 8px;
    font: inherit;
}
.field-readonly {
    background: #eef2f8;
    color: #1a2b3c;
    cursor: not-allowed;
}
.trace-step { margin-top: .75rem; border-top: 1px solid #e2e8f0; padding-top: .75rem; }
.trace-step summary { cursor: pointer; font-weight: 600; }
.trace-step pre { max-height: 320px; overflow: auto; font-size: .75rem; background: #f8fafc; padding: .75rem; border-radius: 6px; margin-top: .5rem; }
.field-full { grid-column: 1 / -1; }

.fieldset {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
}
.fieldset legend { font-weight: 600; padding: 0 .5rem; }

.idades-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; }

.form-actions { display: flex; gap: .75rem; flex-wrap: wrap; }

.section-title { font-size: 1.1rem; color: var(--porto-blue); }

.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
}
.alert-ok { background: #e8f7ef; color: var(--ok); border: 1px solid #b7e4c7; }
.alert-erro { background: #fdecea; color: var(--erro); border: 1px solid #f5c2c0; }
.alert-warn { background: #fff4e5; color: var(--warn); border: 1px solid #ffd8a8; }

.planos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.plano-preco { font-size: 1.5rem; font-weight: 700; color: var(--porto-blue); margin: .5rem 0; }
.plano-hml { font-size: .85rem; margin-bottom: .75rem; }
.plano-ok { border-top: 3px solid var(--ok); }
.plano-warn { border-top: 3px solid var(--warn); }

.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }
.text-muted { color: var(--muted); font-size: .9rem; }
.text-center { text-align: center; }

.list-plain { list-style: none; margin-top: .75rem; }
.list-plain li { padding: .25rem 0; }

.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1.25rem; }
.mb-2 { margin-bottom: 1.25rem; }

pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 8px;
    overflow: auto;
    font-size: .8rem;
    margin-top: .75rem;
}

.icon-ok, .icon-erro {
    width: 64px; height: 64px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 2rem;
    margin: 0 auto 1rem;
}
.icon-ok { background: #e8f7ef; color: var(--ok); }
.icon-erro { background: #fdecea; color: var(--erro); }

code { background: #eef2f8; padding: .1rem .35rem; border-radius: 4px; font-size: .9em; }
