:root {
    --loomy-green: #a6fe1f;
    --loomy-green-hover: #93d500;
    --loomy-green-dark: #4a8526;
    --loomy-gray: #53565a;
    --loomy-charcoal: #292c2e;
    --loomy-ink: #202325;
    --loomy-canvas: #f2f3ef;
    --loomy-surface: #ffffff;
    --loomy-line: #dce0d9;
    --loomy-muted: #71766f;
    --loomy-danger: #b63a3a;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--loomy-canvas);
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 40px 20px;
    overflow-x: hidden;
    color: var(--loomy-ink);
    font-family: 'Montserrat', sans-serif;
    background:
        radial-gradient(circle at 9% 12%, rgba(166, 254, 31, 0.17) 0 5px, transparent 6px),
        radial-gradient(circle at 92% 82%, rgba(83, 86, 90, 0.1) 0 180px, transparent 181px),
        linear-gradient(135deg, #f8f9f5 0%, #e9ece6 100%);
}

body::before,
body::after {
    position: fixed;
    z-index: 0;
    border: 1px solid rgba(83, 86, 90, 0.13);
    border-radius: 50%;
    content: '';
    pointer-events: none;
}

body::before {
    top: -210px;
    right: -160px;
    width: 480px;
    height: 480px;
}

body::after {
    bottom: -240px;
    left: -180px;
    width: 560px;
    height: 560px;
}

button,
input,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.hidden {
    display: none !important;
}

.app-shell {
    position: relative;
    z-index: 1;
    width: min(100%, 760px);
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid rgba(83, 86, 90, 0.16);
    border-radius: 32px;
    background: var(--loomy-surface);
    box-shadow: 0 32px 80px rgba(40, 43, 44, 0.18);
    animation: shell-enter 560ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.brand-header {
    position: relative;
    min-height: 238px;
    padding: 34px 42px 38px;
    overflow: hidden;
    color: #fff;
    background:
        linear-gradient(118deg, rgba(255, 255, 255, 0.035), transparent 45%),
        var(--loomy-charcoal);
}

.brand-header::before {
    position: absolute;
    top: -156px;
    right: -112px;
    width: 360px;
    height: 360px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 50%;
    box-shadow:
        0 0 0 46px rgba(255, 255, 255, 0.025),
        0 0 0 92px rgba(255, 255, 255, 0.018);
    content: '';
}

.brand-header::after {
    position: absolute;
    top: 57px;
    right: 57px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--loomy-green);
    box-shadow: 0 0 28px rgba(166, 254, 31, 0.75);
    content: '';
}

.brand-lockup {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand-logo {
    display: block;
    width: 142px;
    height: auto;
}

.brand-copy {
    position: relative;
    z-index: 1;
    max-width: 560px;
    margin-top: 34px;
}

#headerTitle {
    max-width: 610px;
    margin: 0;
    color: #fff;
    font-size: clamp(2rem, 6.3vw, 3.35rem);
    font-weight: 800;
    letter-spacing: -0.055em;
    line-height: 0.98;
    cursor: pointer;
    transition: opacity 180ms ease;
}

#headerTitle span {
    color: var(--loomy-green);
}

#headerTitle:hover {
    opacity: 0.82;
}

.workspace {
    padding: 28px 42px 44px;
    background:
        linear-gradient(90deg, transparent 0 96%, rgba(83, 86, 90, 0.025) 96%),
        var(--loomy-surface);
    background-size: 26px 100%;
    animation: content-enter 520ms 100ms ease both;
}

.tool-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 30px;
    padding: 6px;
    border: 1px solid var(--loomy-line);
    border-radius: 16px;
    background: #f1f3ef;
}

.tool-tab {
    display: flex;
    min-height: 50px;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 0 16px;
    border: 0;
    border-radius: 11px;
    color: var(--loomy-muted);
    background: transparent;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.045em;
    text-align: left;
    cursor: pointer;
    transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}

.tool-tab:hover {
    color: var(--loomy-ink);
    background: rgba(255, 255, 255, 0.75);
}

.tool-tab.is-active {
    color: var(--loomy-ink);
    background: var(--loomy-green);
    box-shadow: 0 8px 22px rgba(74, 133, 38, 0.18);
}

.tool-tab:active {
    transform: translateY(1px);
}

.tool-index {
    display: inline-grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-size: 0.58rem;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.section-kicker {
    display: block;
    margin-bottom: 7px;
    color: var(--loomy-green-dark);
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.section-heading h2 {
    margin: 0;
    color: var(--loomy-ink);
    font-size: clamp(1.45rem, 4.5vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.08;
}

.section-step {
    flex: 0 0 auto;
    color: #b6bbb3;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.form-stack {
    display: grid;
    gap: 19px;
}

.form-stack > :not([hidden]) ~ :not([hidden]) {
    margin-top: 0 !important;
}

label.block {
    color: #4f554e;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.025em;
}

input:not([type='radio']):not([type='hidden']),
select {
    width: 100%;
    min-height: 52px;
    margin-top: 7px;
    padding: 0 15px;
    border: 1px solid #d6dad3;
    border-radius: 10px;
    outline: none;
    color: var(--loomy-ink);
    background: #fbfcfa;
    box-shadow: none;
    font-size: 0.84rem;
    transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

select {
    cursor: pointer;
}

input:not([type='radio']):not([type='hidden'])::placeholder {
    color: #a2a7a0;
}

input:not([type='radio']):not([type='hidden']):focus,
select:focus {
    border-color: var(--loomy-green-dark);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(166, 254, 31, 0.18);
}

.point-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.point-option {
    display: flex;
    min-height: 48px;
    align-items: center;
    padding: 0 13px;
    border: 1px solid var(--loomy-line);
    border-radius: 10px;
    background: #f7f8f5;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.point-option span {
    color: #505550 !important;
}

input[type='radio'] {
    width: 17px;
    height: 17px;
    accent-color: var(--loomy-green-dark);
}

#gerarDadosBtn,
#addPabxBtn {
    display: flex;
    min-height: 54px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 5px;
    border: 0;
    border-radius: 11px;
    color: var(--loomy-ink);
    background: var(--loomy-green);
    box-shadow: 0 12px 28px rgba(74, 133, 38, 0.2);
    font-size: 0.73rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

#gerarDadosBtn:hover,
#addPabxBtn:hover {
    background: var(--loomy-green-hover);
    box-shadow: 0 14px 32px rgba(74, 133, 38, 0.26);
    transform: translateY(-1px);
}

#gerarDadosBtn:focus-visible,
#addPabxBtn:focus-visible,
#cancelAddPabxBtn:focus-visible,
.tool-tab:focus-visible {
    outline: 3px solid rgba(74, 133, 38, 0.35);
    outline-offset: 3px;
}

#cancelAddPabxBtn {
    min-height: 54px;
    border: 1px solid var(--loomy-line);
    border-radius: 11px;
    color: var(--loomy-ink);
    background: #f4f5f2;
    font-size: 0.73rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    cursor: pointer;
}

#cancelAddPabxBtn:hover {
    border-color: #b8bdb5;
    background: #e9ece6;
}

#messageBox {
    margin: 0 0 24px !important;
    padding: 13px 16px;
    border-radius: 10px;
    font-size: 0.74rem;
    font-weight: 700;
}

#messageBox.bg-green-100 {
    border: 1px solid rgba(74, 133, 38, 0.25) !important;
    color: #355d20 !important;
    background: rgba(166, 254, 31, 0.16) !important;
}

#messageBox.bg-red-100 {
    border: 1px solid rgba(182, 58, 58, 0.2) !important;
    color: #8f2d2d !important;
    background: #fff1f1 !important;
}

#warningBox {
    margin-top: 20px;
    padding: 14px 16px;
    border: 1px solid #e7d88d;
    border-radius: 10px;
    color: #655413;
    background: #fff9da;
    font-size: 0.72rem;
}

#outputSection {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 28px;
    padding: 25px;
    border-radius: 18px;
    color: #fff;
    background:
        radial-gradient(circle at 100% 0%, rgba(166, 254, 31, 0.12), transparent 31%),
        var(--loomy-charcoal);
}

#outputSection:not(.hidden) {
    display: grid;
}

#outputSection > * {
    margin-top: 0 !important;
}

#outputSection hr,
#outputSection h2 {
    grid-column: 1 / -1;
}

#outputSection hr {
    display: none;
}

#outputSection h2 {
    margin: 0 0 5px !important;
    padding: 0;
    color: #fff;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    text-align: left;
}

#outputSection label {
    color: var(--loomy-green) !important;
    font-size: 0.59rem;
    letter-spacing: 0.13em;
}

#outputSection input[readonly] {
    min-height: 47px;
    margin-top: 6px;
    padding-right: 46px;
    border-color: rgba(255, 255, 255, 0.12);
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.73rem;
    font-weight: 600;
}

.copy-btn {
    color: rgba(255, 255, 255, 0.48) !important;
}

.copy-btn:hover {
    color: var(--loomy-green) !important;
}

#pabxSection {
    padding-top: 18px;
}

#pabxSection > label {
    color: var(--loomy-muted) !important;
    font-size: 0.59rem;
    letter-spacing: 0.13em;
}

#pabxLink {
    min-height: 52px;
    margin-top: 7px;
    border: 1px solid #3d4143;
    border-radius: 11px;
    color: #fff;
    background: var(--loomy-gray);
    font-size: 0.75rem;
    font-weight: 700;
}

#pabxLink:hover {
    color: var(--loomy-green);
    background: var(--loomy-charcoal);
}

#instructionsSection {
    margin-top: 22px;
}

#instructionsSection > div {
    padding: 25px;
    border: 1px solid var(--loomy-line);
    border-radius: 16px;
    background: #f5f7f3;
}

#copyInstructionsBtn {
    top: 18px;
    right: 18px;
    color: var(--loomy-gray);
}

#copyInstructionsBtn:hover {
    color: var(--loomy-green-dark);
}

pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
}

#instructionsOutput {
    margin: 0;
    padding-top: 28px;
    color: #414640;
    font-size: 0.73rem;
    line-height: 1.72;
}

#condominioList {
    z-index: 20;
    max-height: 240px;
    margin-top: 7px;
    overflow-y: auto;
    border: 1px solid var(--loomy-line);
    border-radius: 11px;
    color: #454a45;
    background: #fff;
    box-shadow: 0 18px 40px rgba(40, 43, 44, 0.15);
}

#condominioList li:hover {
    color: #2d4022;
    background: rgba(166, 254, 31, 0.18);
    cursor: pointer;
}

#customPabxList {
    margin-top: 25px;
    padding-top: 22px;
    border-top: 1px solid var(--loomy-line);
}

#customPabxList > label {
    margin-bottom: 10px;
    color: var(--loomy-muted) !important;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
}

#customPabxList > div {
    min-height: 60px;
    border-color: var(--loomy-line) !important;
    border-radius: 10px;
    background: #f6f7f4 !important;
}

#customPabxList button {
    color: var(--loomy-danger) !important;
}

#addPabxPage:not(.hidden) {
    display: grid;
    gap: 19px;
}

#addPabxPage > * {
    margin-top: 0 !important;
}

#addPabxPage .section-heading {
    margin-bottom: 7px;
}

#generatorPage,
#addPabxPage {
    animation: page-enter 240ms ease both;
}

@keyframes shell-enter {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes content-enter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes page-enter {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 640px) {
    body {
        padding: 14px 10px 26px;
    }

    .app-shell {
        border-radius: 24px;
    }

    .brand-header {
        min-height: 224px;
        padding: 27px 24px 31px;
    }

    .brand-header::before {
        top: -190px;
        right: -185px;
    }

    .brand-header::after {
        top: 40px;
        right: 32px;
    }

    .brand-logo {
        width: 112px;
    }

    .brand-copy {
        margin-top: 34px;
    }

    #headerTitle {
        font-size: clamp(2rem, 12vw, 2.85rem);
    }

    .workspace {
        padding: 19px 18px 30px;
    }

    .tool-nav {
        margin-bottom: 25px;
    }

    .tool-tab {
        min-height: 48px;
        justify-content: center;
        padding: 0 9px;
        font-size: 0.58rem;
        letter-spacing: 0;
    }

    .tool-index {
        display: none;
    }

    .section-heading {
        margin-bottom: 22px;
    }

    .section-step {
        display: none;
    }

    .point-options,
    #outputSection {
        grid-template-columns: 1fr;
    }

    #outputSection hr,
    #outputSection h2 {
        grid-column: 1;
    }

    #outputSection {
        padding: 21px 17px;
    }

    #instructionsSection > div {
        padding: 20px 17px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
