:root {
    --ink: #16283b;
    --navy: #18182e;
    --muted: #526377;
    --line: #dce4e8;
    --accent-light: #ded5ff;
    --bs-body-font-family: "Segoe UI", system-ui, sans-serif;
}

body { background: #f3f5f3; color: var(--ink); }
a, button, input, select, textarea { scroll-margin-top: 1rem; }
.app-width { width: min(100% - 3rem, 1380px); margin-inline: auto; }
.masthead { background: var(--navy); color: white; border-bottom: 1px solid #363451; }
.masthead-inner { min-height: 4.5rem; display: flex; align-items: center; gap: clamp(1rem, 4vw, 4rem); }
.brand { display: inline-flex; align-items: center; gap: .7rem; color: #f5fafb; font-weight: 760; letter-spacing: -.025em; text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--accent-light); }
.brand-mark { inline-size: 2rem; block-size: 2rem; border-radius: .55rem; background: #bcaaff; display: grid; place-items: center; }
.brand-mark::before {
    content: '';
    width: 1.36rem;
    height: 1.12rem;
    background: #272044;
    clip-path: polygon(0 47%, 23% 47%, 35% 14%, 46% 14%, 60% 71%, 73% 47%, 100% 47%, 100% 59%, 79% 59%, 64% 90%, 53% 90%, 39% 33%, 30% 59%, 0 59%);
}
.app-nav { display: flex; align-items: center; gap: .25rem; }
.app-nav a { color: #c4d2df; padding: .55rem .8rem; border-radius: .45rem; text-decoration: none; font-size: .9rem; font-weight: 600; white-space: nowrap; }
.app-nav a:hover, .app-nav a[aria-current="page"] { color: #fff; background: #2b4058; }
.account-nav { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.account-nav .btn { color: #eef4fa; }
.account-nav .btn:hover { background: #2b4058; }
.account-initial { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; color: var(--accent-light); border: 1px solid #655e84; font-size: .85rem; font-weight: 700; }
.main-shell { padding-block: clamp(1.3rem, 4vw, 3rem) 4rem; }
.overview-hero { position: relative; isolation: isolate; overflow: hidden; border-radius: 1.1rem; padding: clamp(1.5rem, 4vw, 3.4rem); background: linear-gradient(108deg, #1a1930 6%, #302756 60%, #533894); color: #fff; min-height: 15.25rem; }
.hero-content { max-width: 42rem; }
.overview-hero h1, .page-intro h1 { font-weight: 770; font-size: clamp(1.9rem, 4vw, 3.4rem); letter-spacing: -.053em; line-height: 1.06; margin: 0 0 .8rem; text-wrap: balance; }
.overview-hero p { color: #e4def7; max-width: 39ch; margin: 0 0 1.25rem; font-size: 1.02rem; }
.hero-action, .hero-action:hover { display: inline-flex; gap: .8rem; align-items: center; background: var(--accent-light); color: #302055; font-weight: 700; border-color: transparent; }
.hero-action:hover { background: #eee8ff; }
.hero-art { position: absolute; z-index: -1; inset: 0 0 0 66%; overflow: hidden; background: radial-gradient(circle at 73% 50%, #c4a8ff45, transparent 67%); }
.hero-art span { position: absolute; width: 17rem; height: 17rem; border: 1px solid #dcd0ff65; border-radius: 24%; transform: rotate(-28deg); top: 36%; left: 55%; }
.hero-art span:nth-child(2) { width: 22rem; height: 22rem; top: 24%; left: 43%; }
.hero-art span:nth-child(3) { width: 27rem; height: 27rem; top: 12%; left: 31%; }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .85rem; margin-block: 1.15rem 1.5rem; }
.metric { min-width: 0; display: grid; gap: .35rem; background: #fff; border: 1px solid var(--line); border-radius: .8rem; padding: .85rem 1.05rem; }
.metric-label { display: inline-flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .86rem; font-weight: 600; }
.metric strong { font-size: clamp(1.35rem, 2.7vw, 2rem); line-height: 1.1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-dot { width: .48rem; height: .48rem; border-radius: 50%; background: #8796a6; }
.metric-dot.is-online { background: #248665; }
.card { border-color: var(--line); border-radius: .9rem; box-shadow: 0 2px 5px #172d4408; }
.panel { padding: clamp(1.05rem, 2.6vw, 1.65rem); }
.panel-title { font-weight: 720; letter-spacing: -.025em; margin-bottom: 1rem; }
.connection-table-wrap { border: 1px solid var(--line); border-radius: .7rem; }
.connection-table thead th { background: #f3f1f8; color: #534866; font-size: .8rem; }
.connection-table th, .connection-table td { padding: .65rem .9rem; }
.connection-table tr:last-child td { border-bottom: 0; }
.connection-table tr.active-connection td { --bs-table-bg: #f8f5ff; }
.instance-name { color: #302055; font-weight: 700; text-align: left; padding: .25rem .15rem; overflow-wrap: anywhere; }
.instance-name:hover { color: #5838a2; text-decoration: underline; }
.connection-state { display: inline-block; border-radius: 99px; padding: .25rem .55rem; background: #eef0f3; color: #43526d; font-size: .78rem; font-weight: 650; white-space: nowrap; }
.connection-state[data-state="connected"] { background: #e6f4eb; color: #216143; }
.connection-state[data-state="connecting"] { background: #fff2d7; color: #74571e; }
.connection-state[data-state="error"] { background: #fae8e9; color: #852e34; }
.connection-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.page-intro { margin-bottom: 1.5rem; }
.page-intro p { color: var(--muted); margin-bottom: 0; }
.connect-form { padding: 1rem; margin-bottom: .75rem; border-radius: .75rem; background: #eef5f1; }
.form-label, .connect-form label { font-size: .89rem; font-weight: 650; }
.form-control, .form-select { border-color: #cbd6dc; border-radius: .5rem; }
.form-control:focus, .form-select:focus { border-color: #428b76; box-shadow: 0 0 0 .2rem #428b7633; }
.btn { --bs-btn-border-radius: .5rem; }
.btn-primary { --bs-btn-bg: #5838a2; --bs-btn-border-color: #5838a2; --bs-btn-hover-bg: #472987; --bs-btn-hover-border-color: #472987; --bs-btn-active-bg: #38216b; --bs-btn-active-border-color: #38216b; --bs-btn-disabled-bg: #5838a2; --bs-btn-disabled-border-color: #5838a2; }
.btn-outline-primary { --bs-btn-color: #5838a2; --bs-btn-border-color: #a795ce; --bs-btn-hover-bg: #5838a2; --bs-btn-hover-border-color: #5838a2; --bs-btn-active-bg: #472987; --bs-btn-active-border-color: #472987; }
.notice { padding: .75rem 1rem; margin-block: 0 1rem; border-radius: .55rem; background: #fcedec; color: #812b29; }
.notice:empty { display: none; }
.login-card { max-width: 28rem; }
.pairing { background: #eef6f2; border: 1px solid #c5ddd0; border-radius: .7rem; }
.pairing img { max-width: 100%; height: auto; background: white; padding: .45rem; border-radius: .5rem; }
.history { min-height: 14rem; max-height: 24rem; overflow-y: auto; background: #eef3f5; border: 1px solid #e4eaf0; border-radius: .7rem; }
.history:empty::before { content: 'Selecione uma conversa para ver as mensagens.'; color: var(--muted); font-size: .9rem; }
.history li { background: white; border-radius: .65rem; margin-bottom: .65rem; padding: .65rem .85rem; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 85%; }
.history .outbound { background: #d5ebe1; margin-left: auto; }
.history small { display: block; color: #42536a; }
[hidden] { display: none !important; }

@media (max-width: 650px) {
    .connection-settings { grid-template-columns: 1fr; }
    .app-width { width: calc(100% - 1.5rem); }
    .masthead-inner { flex-wrap: wrap; gap: .35rem; padding-block: .65rem; }
    .app-nav { order: 3; width: 100%; }
    .app-nav a { padding: .5rem .65rem; }
    .hero-art { inset-inline-start: 45%; opacity: .48; }
    .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
    .metric:first-child { grid-column: 1 / -1; }
}
