:root {
    --ink: #1c2430;
    --muted: #5d6874;
    --line: #e3ddd3;
    --paper: #f6f3ee;
    --white: #fff;
    --accent: #0f6e6b;
    --accent-soft: #e7f3f2;
    --danger: #8d2d2d;
    --ok: #1d6b45;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font: 16px/1.5 "Segoe UI", sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.7rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 .6rem; }
.lead { margin-top: 0; max-width: 42rem; }
.meta { color: var(--muted); }
code { font-size: .92em; }

.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
aside {
    background: #16302e;
    color: #f4f1ea;
    padding: 1.4rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.brand { color: inherit; text-decoration: none; font-size: 1.35rem; letter-spacing: .03em; line-height: 1.15; }
.brand-note { margin: 0 0 1rem; color: #c9d5d3; font-size: .9rem; }
nav { display: flex; flex-direction: column; gap: .85rem; }
.nav-group { display: flex; flex-direction: column; gap: .15rem; }
.nav-label {
    margin: 0 .6rem .15rem;
    color: #9eb0ad;
    font-size: .68rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}
nav a { color: #f4f1ea; text-decoration: none; padding: .45rem .6rem; border-radius: 8px; }
nav a.is-on, nav a:hover { background: rgba(255,255,255,.1); }
aside form { margin-top: auto; }
.credit {
    margin: .9rem 0 0;
    padding-top: .8rem;
    border-top: 1px solid rgba(255, 255, 255, .12);
    display: grid;
    gap: .1rem;
    font-size: .78rem;
    line-height: 1.35;
}
.credit span {
    color: #9eb0ad;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-size: .68rem;
}
.credit .credit-version {
    color: #f4f1ea;
    letter-spacing: .02em;
    text-transform: none;
    font-size: .8rem;
    margin-bottom: .35rem;
}
.credit a { color: #f4f1ea; text-decoration: none; }
.credit a:hover { text-decoration: underline; }
main { padding: 1.6rem 1.8rem 6rem; max-width: 980px; }

.card, table, .transcript { background: var(--white); border: 1px solid var(--line); border-radius: 12px; }
.card { padding: 1rem 1.1rem 1.2rem; display: grid; gap: .8rem; max-width: 40rem; margin: 0 0 1rem; }
label { display: grid; gap: .3rem; font-size: .92rem; }
input, textarea, select {
    font: inherit;
    padding: .55rem .7rem;
    border: 1px solid #cfc8bc;
    border-radius: 8px;
    background: #fff;
    color: inherit;
}
textarea { resize: vertical; }
.check { display: flex; align-items: center; gap: .5rem; }
.check input { width: auto; }
button, .button {
    font: inherit;
    background: var(--accent);
    color: white;
    border: 0;
    border-radius: 8px;
    padding: .55rem .9rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.button-quiet, button.linkish {
    background: transparent;
    color: var(--accent);
    padding-left: 0;
    padding-right: 0;
}
aside button.linkish { color: #f4f1ea; }
.actions { display: flex; gap: .8rem; align-items: center; margin: 1rem 0; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin: 1rem 0 1.2rem; }
.stats article { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.05rem .9rem; }
.stats strong { display: block; font-size: 1.9rem; letter-spacing: -.03em; line-height: 1.1; }
.stats span { display: block; margin-top: .3rem; color: var(--muted); font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; }
.talks { display: grid; gap: .65rem; }
.talk {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .35rem 1.2rem;
    align-items: center;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: .85rem 1rem;
}
.talk-who { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .65rem; margin: 0 0 .25rem; }
.talk-name { font-weight: 650; }
.talk-line { color: var(--ink); text-decoration: none; font-size: 1.02rem; }
.talk-line:hover { color: var(--accent); }
.talk-side { display: grid; justify-items: end; gap: .25rem; color: var(--muted); font-size: .86rem; }
.talk-side form { margin: 0; }
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
th, td { text-align: left; padding: .7rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .82rem; color: var(--muted); font-weight: 600; }
td form, .row-actions form { margin: 0; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: .8rem; white-space: nowrap; }
.inline-form { display: flex; gap: .4rem; align-items: center; }
.inline-form input { min-width: 10rem; }
.actions form { margin: 0; }
.flash { padding: .7rem .85rem; border-radius: 8px; }
.flash-ok { background: #e7f6ee; color: var(--ok); }
.flash-err { background: #fdecec; color: var(--danger); }
.plain { list-style: none; padding: 0; }
.plain li { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.sync-row { display: grid; gap: .7rem; margin-bottom: 1rem; }
.sync-row form { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.search { display: flex; gap: .6rem; align-items: center; margin: 1rem 0; }
.search input { min-width: min(100%, 280px); }
.pager { display: flex; gap: .7rem; flex-wrap: wrap; }
.transcript { padding: 1rem; display: grid; gap: .7rem; }
.bubble { max-width: 38rem; padding: .7rem .85rem; border-radius: 12px; background: var(--paper); }
.bubble span { display: block; font-size: .78rem; color: var(--muted); }
.bubble p { margin: .2rem 0 0; white-space: pre-wrap; }
.bubble-user { margin-left: auto; background: var(--accent-soft); }
.bubble-operator { background: #fff6e8; }
.badge {
    display: inline-block;
    margin-left: .35rem;
    padding: .1rem .5rem;
    border-radius: 999px;
    background: var(--paper);
    color: var(--muted);
    font-size: .75rem;
    line-height: 1.4;
    vertical-align: middle;
}
.badge-live { background: #e7f6ee; color: var(--ok); }
.badge-human { background: #fff4e5; color: #8a5a12; }
.ip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
.table-wrap { overflow-x: auto; }
.card-live { border-color: #9dcec4; box-shadow: 0 0 0 3px rgba(15, 110, 107, .08); }
.danger-card { border-color: #e7c4c4; max-width: 40rem; }
.button-danger { background: var(--danger); color: #fff; }
.login-body { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: min(100% - 2rem, 24rem); }
.eyebrow { margin: 0; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; font-size: .78rem; }
.embed-card { margin-bottom: 1rem; }
.embed-card .lead { margin-bottom: 0; }
.embed-code {
    margin: 0;
    padding: .75rem .85rem;
    background: #16302e;
    color: #f6f3ee;
    border-radius: 8px;
    overflow: auto;
    font-size: .86rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-all;
}
.launcher-field { border: 0; margin: 0; padding: 0; display: grid; gap: .8rem; }
.launcher-field legend { font-weight: 650; padding: 0; }
.choice-row { display: flex; flex-wrap: wrap; gap: .6rem 1rem; }
.choice { display: flex; align-items: center; gap: .4rem; }
.choice input { width: auto; }
.bubble-stage {
    background: #efeae2;
    border-radius: 12px;
    min-height: 92px;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 1rem 1rem 1.1rem;
}
.bubble-preview {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: #16302e;
    color: #f6f3ee;
    border-radius: 999px;
    padding: .7rem .95rem;
    font-size: .95rem;
    line-height: 1.2;
    box-shadow: 0 8px 24px rgba(22, 48, 46, .25);
}
.bubble-preview.is-fumetto {
    position: relative;
    background: #fff;
    color: #16302e;
    border-radius: 16px 16px 5px 16px;
    margin-bottom: 8px;
}
.bubble-preview.is-fumetto::after {
    content: "";
    position: absolute;
    right: 14px;
    bottom: -6px;
    width: 12px;
    height: 12px;
    background: #fff;
    transform: rotate(45deg);
}
.bubble-preview.is-icona { padding: .35rem .75rem .35rem .35rem; }
.bubble-mark {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #0f6e6b;
    flex: none;
}
.bubble-label { max-width: 11rem; }

@media (max-width: 800px) {
    .shell { grid-template-columns: 1fr; }
    aside { padding-bottom: .6rem; }
    nav { gap: .7rem; }
    aside form { margin-top: .8rem; }
    .credit { margin-top: .6rem; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .talk { grid-template-columns: 1fr; }
    .talk-side { justify-items: start; }
    main { padding: 1rem 1rem 6rem; }
}
