:root {
    --ink: #203b37;
    --muted: #6e7e79;
    --green: #217c62;
    --dark: #123a35;
    --line: #dde5df;
    --paper: #f5f6f1;
    --orange: #b75d28;
    --radius: 15px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    font-size: 14px;
    background: var(--paper)
}

* {
    box-sizing: border-box
}

body {
    margin: 0
}

button,
input,
select {
    font: inherit
}

button,
a,
input,
select {
    outline-offset: 4px
}

button {
    cursor: pointer;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: white;
    padding: 10px 16px;
    color: var(--ink);
    font-weight: 600;
    transition: background .15s
}

button:hover {
    background: #eff4ee
}

button:disabled {
    opacity: .5;
    cursor: wait
}

.primary {
    background: var(--green);
    border-color: var(--green);
    color: white
}

.primary:hover {
    background: #16664f
}

.danger {
    color: #a54336;
    border-color: #edcfc9
}

.subtle {
    background: transparent;
    border-color: transparent
}

.small {
    padding: 7px 11px;
    font-size: 12px
}

a {
    color: var(--green);
    text-decoration: none
}

h1,
h2,
h3,
p {
    margin-top: 0
}

h1 {
    font-size: 32px;
    letter-spacing: -1px;
    margin-bottom: 10px
}

h2 {
    font-size: 20px;
    letter-spacing: -.4px
}

h3 {
    font-size: 16px
}

p {
    line-height: 1.65
}

.muted {
    color: var(--muted)
}

.eyebrow {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.8px;
    font-weight: 700;
    color: var(--green);
    margin-bottom: 14px
}

.loading {
    padding: 60px;
    color: var(--muted)
}

.layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 224px 1fr
}

.sidebar {
    background: var(--dark);
    color: #e1eee5;
    padding: 34px 22px;
    position: fixed;
    width: 224px;
    height: 100vh;
    display: flex;
    flex-direction: column
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -1px;
    color: inherit
}

.brandmark {
    width: 34px;
    height: 34px;
    background: #c5df9d;
    color: var(--dark);
    display: grid;
    place-items: center;
    border-radius: 10px;
    font-size: 27px;
    font-weight: 800
}

.brand small {
    display: block;
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 1.1px;
    color: #9db8ad;
    margin-top: 2px
}

/* Official SIIP Internet logo. The existing brand markup remains as a
   fallback, while the image is used consistently in the login and sidebar. */
.brand {
    width: 168px;
    height: 83px;
    background: url('/static/branding/logo-siip_internet-blanco.png') center / contain no-repeat;
    font-size: 0;
}

.brandmark,
.brand > div {
    display: none;
}

.login-art .brand {
    width: 245px;
    height: 121px;
}

.nav {
    display: grid;
    gap: 7px;
    margin-top: 51px
}

.nav button {
    background: transparent;
    border: 0;
    color: #b5cec1;
    text-align: left;
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 13px;
    font-weight: 500
}

.nav button.active {
    background: #2b5148;
    color: #eaf4ce
}

.nav button:hover {
    background: #234b42
}

.nav svg {
    width: 19px;
    height: 19px;
    flex-shrink: 0
}

.sidebar-bottom {
    margin-top: auto;
    border-top: 1px solid #34564c;
    padding-top: 22px;
    font-size: 11px;
    color: #a6c2b5
}

.sidebar-bottom .dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #c5df9d;
    border-radius: 50%;
    margin-right: 6px
}

.main {
    grid-column: 2;
    min-width: 0
}

.topbar {
    height: 76px;
    border-bottom: 1px solid var(--line);
    padding: 0 42px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fbfcf8
}

.topbar .meta {
    display: flex;
    gap: 12px;
    align-items: center
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e3ebdc;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700
}

.workspace {
    padding: 38px 42px;
    max-width: 1510px;
    margin: auto
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 30px
}

.page-heading p {
    margin: 0;
    color: var(--muted)
}

.panel {
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 25px;
    margin-bottom: 22px
}

.panel h2 {
    margin-bottom: 7px
}

.panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 23px;
    gap: 12px
}

.panel-title h2 {
    margin: 0
}

.step {
    font-size: 11px;
    border: 1px solid #cddccf;
    background: #f4f7ee;
    border-radius: 6px;
    padding: 4px 7px;
    color: var(--green);
    margin-right: 10px;
    vertical-align: middle
}

.grid {
    display: grid;
    gap: 20px
}

.grid.two {
    grid-template-columns: 1fr 1fr
}

.grid.three {
    grid-template-columns: repeat(3, 1fr)
}

.emit-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 302px;
    gap: 24px;
    align-items: start
}

.summary {
    background: #edf1e6;
    border-color: #dbe4ce
}

.summary .total {
    font-size: 53px;
    font-weight: 600;
    letter-spacing: -2px;
    margin: 25px 0 0
}

.summary .pages {
    border-top: 1px solid #d3ddcb;
    margin-top: 24px;
    padding-top: 18px;
    display: flex;
    justify-content: space-between
}

.summary .primary {
    width: 100%;
    margin-top: 25px
}

.summary ul {
    padding-left: 18px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.8
}

.summary-lines {
    padding-top: 22px;
    font-size: 13px
}

.summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 8px
}

.callout {
    padding: 15px 17px;
    border-radius: 9px;
    background: #f0f5ef;
    font-size: 12px;
    line-height: 1.7;
    color: #526a57;
    display: flex;
    gap: 12px
}

.callout.warning {
    background: #fff5e7;
    color: #946329
}

.callout.error {
    background: #fff0ed;
    color: #a34537
}

.community-option {
    display: block;
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 18px;
    cursor: pointer;
    background: white;
    position: relative
}

.community-option.selected {
    border-color: var(--green);
    background: #f3f8f2;
    box-shadow: 0 0 0 1px var(--green)
}

.community-option input {
    width: auto;
    position: absolute;
    right: 15px;
    top: 15px;
    accent-color: var(--green)
}

.community-option strong {
    display: block;
    font-size: 15px;
    margin-bottom: 10px;
    padding-right: 18px
}

.community-option .muted {
    font-size: 12px;
    word-break: break-word
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 650;
    padding: 4px 7px;
    letter-spacing: .2px;
    background: #edf1e9;
    color: #596d51;
    white-space: nowrap
}

.badge.good {
    color: #166a51;
    background: #e6f3e9
}

.badge.warn {
    color: #9d6128;
    background: #fff1d9
}

.badge.bad {
    color: #a94438;
    background: #ffeae4
}

.community-option .badge {
    margin-top: 15px
}

.line {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) 90px 32px;
    gap: 12px;
    align-items: end;
    margin-bottom: 17px
}

.line button {
    padding: 9px 5px
}

.line-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 12px
}

.empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted)
}

.empty h3 {
    color: var(--ink)
}

label.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 17px
}

input,
select {
    width: 100%;
    background: #fcfdfb;
    border: 1px solid #cdd9d0;
    border-radius: 8px;
    color: var(--ink);
    padding: 11px 12px;
    min-width: 0
}

input:focus,
select:focus {
    outline: 2px solid #8fbd9d;
    outline-offset: 1px
}

input[type=checkbox],
input[type=radio] {
    width: auto;
    accent-color: var(--green)
}

input[type=file] {
    font-size: 12px;
    padding: 8px
}

input[type=range] {
    padding: 0
}

label.check {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12px;
    margin-bottom: 18px
}

label small {
    font-weight: 400;
    line-height: 1.5;
    color: var(--muted)
}

.actions {
    display: flex;
    gap: 9px;
    align-items: center;
    flex-wrap: wrap
}

.card {
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 22px;
    background: white;
    display: flex;
    flex-direction: column
}

.card p {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 12px;
    word-break: break-word
}

.card .card-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: start
}

.card .actions {
    margin-top: auto;
    padding-top: 15px
}

.card h3 {
    margin-bottom: 12px
}

.card .banner {
    width: 100%;
    height: 80px;
    object-fit: contain;
    background: #fafbf8;
    border-radius: 7px;
    margin: 20px 0
}

.card .missing-banner {
    height: 80px;
    background: repeating-linear-gradient(135deg, #f7f7ee, #f7f7ee 8px, #f1f1e8 8px, #f1f1e8 9px);
    display: grid;
    place-items: center;
    color: #8c896e;
    font-size: 11px;
    margin: 20px 0;
    border-radius: 7px
}

.card .stats {
    display: flex;
    gap: 18px;
    font-size: 12px;
    color: var(--muted)
}

.card.inactive {
    opacity: .7
}

.logo-panel {
    display: grid;
    grid-template-columns: 115px 1fr 240px;
    gap: 24px;
    align-items: center
}

.logo-preview {
    width: 115px;
    height: 80px;
    object-fit: contain;
    background: #f7f9f4;
    border: 1px dashed #c9d5c6;
    border-radius: 8px
}

.logo-panel p {
    margin: 5px 0 0;
    font-size: 12px
}

.table-wrap {
    overflow: auto;
    background: white;
    border: 1px solid var(--line);
    border-radius: 13px
}

table {
    border-collapse: collapse;
    width: 100%;
    text-align: left;
    white-space: nowrap
}

th {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    padding: 15px 20px;
    background: #fafcf7;
    border-bottom: 1px solid var(--line)
}

td {
    padding: 19px 20px;
    border-bottom: 1px solid #edf0e9;
    font-size: 13px
}

td small {
    display: block;
    font-size: 11px;
    color: var(--muted);
    margin-top: 5px
}

tr:last-child td {
    border-bottom: 0
}

.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px
}

.pdf-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
    align-items: start
}

.pdf-viewer {
    width: 100%;
    height: 710px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #e4e8e0
}

.detail-list {
    max-height: 230px;
    overflow: auto;
    font-size: 12px
}

.detail-row {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #edf0e9;
    padding: 9px 0;
    gap: 7px
}

.detail-row div {
    min-width: 0
}

.detail-row small {
    display: block;
    color: #a54336;
    line-height: 1.5;
    margin-top: 5px
}

.detail-actions {
    display: grid;
    gap: 10px;
    margin: 22px 0
}

.detail-actions button,
.detail-actions a {
    display: block;
    text-align: center
}

.button-link {
    background: white;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 10px 16px;
    font-weight: 600;
    color: var(--ink)
}

.meta-list {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    font-size: 12px;
    margin-top: 22px
}

.meta-list strong {
    text-align: right
}

.login {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh
}

.login-art {
    background: var(--dark);
    color: #f2f4e3;
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: space-between
}

.login-art h1 {
    font-size: 52px;
    line-height: 1.15;
    max-width: 500px;
    font-weight: 500;
    margin-top: 70px;
    margin-bottom: 25px
}

.login-art p {
    max-width: 380px;
    color: #b6cfc0
}

.login-art .eyebrow {
    color: #c5df9d
}

.login-content {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 45px
}

.login-form {
    width: 100%;
    max-width: 350px
}

.login-form h2 {
    font-size: 29px
}

.login-form .primary {
    width: 100%;
    margin-top: 8px
}

.login-form .note {
    margin-top: 35px;
    font-size: 11px;
    line-height: 1.7;
    color: var(--muted)
}

.login-art .foot {
    font-size: 11px;
    letter-spacing: 1px;
    color: #b0c2b0;
    margin-top: 70px
}

.login-card {
    margin-top: 30px;
    display: flex;
    gap: 10px;
    align-items: center
}

.login-card span {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid #577161;
    border-radius: 50%;
    font-size: 12px
}

.login-card div {
    height: 1px;
    width: 40px;
    background: #577161
}

dialog {
    border: 1px solid var(--line);
    border-radius: 17px;
    width: min(780px, calc(100vw - 30px));
    max-height: 92vh;
    padding: 0;
    color: var(--ink);
    box-shadow: 0 24px 90px #122f3540
}

dialog.wide {
    width: min(1150px, calc(100vw - 30px))
}

dialog::backdrop {
    background: #163b3566;
    backdrop-filter: blur(3px)
}

.modal-head {
    padding: 22px 26px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    background: white;
    z-index: 1
}

.modal-head h2 {
    margin: 0
}

.modal-body {
    padding: 25px
}

.modal-foot {
    padding: 18px 25px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #fafbf8
}

.modal-body .form-error {
    margin-bottom: 15px
}

.plan-form-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px
}

.plan-form-layout iframe {
    height: 530px;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #f1f3ed
}

.upload-preview {
    height: 100px;
    width: 100%;
    object-fit: contain;
    background: #f5f7f0;
    border-radius: 8px;
    margin-bottom: 15px
}

.divider {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 24px 0
}

.test-output {
    white-space: pre-wrap;
    padding: 15px;
    background: #eef4ea;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.8
}

#toast {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100vw - 30px);
    padding: 14px 23px;
    background: var(--dark);
    color: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px #102b3429;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
    line-height: 1.5
}

#toast.visible {
    opacity: 1
}

#toast.error {
    background: #903e32
}

.inline-error {
    font-size: 12px;
    color: #a74337;
    margin-bottom: 15px
}

.pagination {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    align-items: center;
    font-size: 12px
}

.form-error:empty {
    display: none
}

.form-error {
    background: #fff0ed;
    color: #a34537;
    padding: 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.6
}

.responsive-only {
    display: none
}

@media(min-width:1550px) {
    .workspace {
        padding-top: 48px
    }
}

@media(max-width:1150px) {
    .sidebar {
        width: 190px;
        padding: 30px 15px
    }

    .layout {
        grid-template-columns: 190px 1fr
    }

    .workspace {
        padding: 30px 26px
    }

    .topbar {
        padding: 0 26px
    }

    .emit-layout,
    .pdf-layout {
        grid-template-columns: minmax(0, 1fr) 255px;
        gap: 18px
    }

    .grid.three {
        grid-template-columns: 1fr 1fr
    }

    .panel {
        padding: 21px
    }

    .logo-panel {
        grid-template-columns: 90px 1fr
    }

    .logo-preview {
        width: 90px
    }

    .logo-panel .logo-controls {
        grid-column: 1/-1
    }

    .logo-controls input {
        max-width: 300px
    }

    .login-art {
        padding: 40px
    }

    .login-art h1 {
        font-size: 42px
    }
}

@media(max-width:850px) {
    .layout {
        grid-template-columns: 1fr
    }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        padding: 18px 22px;
        display: block
    }

    .sidebar .brand {
        font-size: 23px
    }

    .sidebar .brand small,
    .sidebar-bottom {
        display: none
    }

    .nav {
        display: flex;
        margin-top: 20px;
        gap: 5px;
        overflow-x: auto
    }

    .nav button {
        padding: 9px 11px;
        font-size: 12px;
        white-space: nowrap
    }

    .nav svg {
        width: 16px;
        height: 16px
    }

    .main {
        grid-column: 1
    }

    .topbar {
        height: 59px
    }

    .workspace {
        padding: 28px 22px
    }

    .emit-layout,
    .pdf-layout {
        grid-template-columns: 1fr
    }

    .summary .total {
        font-size: 40px;
        margin-top: 15px
    }

    .summary ul {
        display: none
    }

    .pdf-viewer {
        height: 600px
    }

    .login-art {
        padding: 35px
    }

    .login-art h1 {
        font-size: 34px
    }

    .plan-form-layout {
        grid-template-columns: 1fr
    }

    .plan-form-layout iframe {
        height: 420px
    }

    .grid.three {
        grid-template-columns: 1fr 1fr
    }
}

@media(max-width:560px) {
    h1 {
        font-size: 27px
    }

    .login {
        grid-template-columns: 1fr
    }

    .login-art {
        padding: 25px
    }

    .login-art h1 {
        font-size: 28px;
        margin: 28px 0 15px
    }

    .login-art p,
    .login-art .foot,
    .login-card {
        display: none
    }

    .login-content {
        padding: 35px 25px
    }

    .page-heading {
        gap: 12px;
        margin-bottom: 25px
    }

    .page-heading button {
        font-size: 12px;
        padding: 9px
    }

    .grid.two,
    .grid.three {
        grid-template-columns: 1fr
    }

    .workspace {
        padding: 25px 16px
    }

    .topbar {
        padding: 0 16px;
        font-size: 12px
    }

    .panel {
        padding: 18px
    }

    .toolbar {
        align-items: flex-start;
        flex-wrap: wrap
    }

    .pdf-viewer {
        height: 480px
    }

    .line {
        grid-template-columns: 1fr 65px 28px;
        gap: 8px
    }

    .modal-body {
        padding: 18px
    }

    .modal-head {
        padding: 18px
    }

    .logo-panel {
        gap: 15px
    }

    .meta .avatar {
        display: none
    }

    .nav {
        justify-content: space-between
    }

    .nav button {
        padding: 9px 5px;
        gap: 5px
    }

    .nav svg {
        display: none
    }
}

@media(max-width:850px) {
    .layout {
        grid-template-columns: minmax(0, 1fr)
    }

    .sidebar {
        min-width: 0
    }
}

.help-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 22px;
    align-items: start
}

.help-nav {
    display: grid;
    gap: 13px;
    position: sticky;
    top: 20px
}

.help-nav a {
    font-size: 13px;
    color: var(--muted)
}

.help-nav a:hover {
    color: var(--green)
}

.help-content section {
    scroll-margin-top: 25px
}

.help-content h2 {
    margin-bottom: 12px
}

.help-content p,
.help-content li,
.help-content dd {
    color: var(--muted);
    line-height: 1.7
}

.help-content ol {
    padding-left: 21px
}

.help-content dt {
    font-weight: 700;
    color: var(--ink);
    margin-top: 15px
}

.help-content dd {
    margin-left: 0
}

.help-content code {
    font-size: 12px;
    background: #edf2eb;
    border-radius: 4px;
    padding: 2px 5px
}

@media(max-width:850px) {
    .help-layout {
        grid-template-columns: 1fr
    }

    .help-nav {
        position: static;
        display: flex;
        gap: 12px;
        overflow: auto;
        white-space: nowrap
    }

    .help-nav .eyebrow {
        display: none
    }
}
