:root {
    --bg: #0f1115;
    --panel: #171a21;
    --panel-2: #1e222b;
    --border: #2a2f3a;
    --text: #e6e8ec;
    --muted: #8b93a3;
    --accent: #5865f2;
    --red: #ef4444;
    --green: #22c55e;
    --radius: 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

[hidden] {
    display: none !important;
}

h2 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin: 24px 0 10px;
}

input,
textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    resize: vertical;
}

input:focus,
textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    border-radius: 8px;
    padding: 7px 12px;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    border-color: #3a4150;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
}

.btn-danger {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.btn-ghost {
    background: transparent;
}

.btn-sm {
    padding: 4px 9px;
    font-size: 13px;
}

.pill {
    font-size: 12px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--panel-2);
    border: 1px solid var(--border);
}

.pill.ok {
    color: var(--green);
}

.pill.bad {
    color: var(--red);
}

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

.error {
    color: var(--red);
    min-height: 1em;
    margin: 0;
}

.brand {
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 0 10px var(--red);
}

/* login */
.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 16px;
}

.login-card {
    width: min(340px, 100%);
    display: grid;
    gap: 12px;
    background: var(--panel);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* layout */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
    position: sticky;
    top: 0;
    z-index: 5;
    flex-wrap: wrap;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.layout {
    display: grid;
    grid-template-columns: minmax(320px, 420px) 1fr;
    gap: 20px;
    padding: 0 20px 20px;
    max-width: 1500px;
    margin: 0 auto;
}

@media (max-width: 900px) {
    .layout {
        grid-template-columns: 1fr;
        padding: 0 16px 16px;
    }
}

/* guilds & channels */
.guild {
    margin-bottom: 16px;
}

.guild-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 8px;
}

.guild-name img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.channel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 8px;
}

.channel.recording {
    border-color: var(--red);
    box-shadow: 0 0 0 1px var(--red) inset;
}

.channel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.channel-name {
    font-weight: 600;
}

.channel-name::before {
    content: '🔊 ';
}

.members {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.member {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--panel-2);
    border-radius: 999px;
    padding: 2px 8px 2px 2px;
    font-size: 12px;
}

.member img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid transparent;
}

.member.speaking img {
    border-color: var(--green);
}

.member.bot {
    opacity: 0.6;
}

.rec-badge {
    color: var(--red);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.start-form {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.empty-channels summary {
    color: var(--muted);
    cursor: pointer;
    margin: 4px 0 8px;
}

/* sessions list */
.sessions {
    display: grid;
    gap: 6px;
}

.session-item {
    text-align: left;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.session-item.active {
    border-color: var(--accent);
}

.session-item .t {
    font-weight: 600;
    display: flex;
    gap: 6px;
    align-items: center;
}

.session-item .s {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

/* session view */
.col-right {
    padding-top: 24px;
    min-width: 0;
}

.placeholder {
    color: var(--muted);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
}

.session-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.session-head > div:first-child {
    flex: 1;
    min-width: 220px;
}

.title-input {
    font-size: 18px;
    font-weight: 700;
    background: transparent;
    border-color: transparent;
    padding: 4px 6px;
    margin-left: -6px;
}

.title-input:hover {
    border-color: var(--border);
}

.meta {
    color: var(--muted);
    font-size: 13px;
}

.session-actions {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.hint-box {
    margin: 12px 0;
}

.hint-box summary {
    cursor: pointer;
    color: var(--muted);
    margin-bottom: 6px;
}

.status-row {
    display: flex;
    gap: 12px;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.transcript {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    max-height: calc(100vh - 260px);
    overflow-y: auto;
    line-height: 1.55;
}

@media (max-width: 900px) {
    .transcript {
        max-height: none;
    }
}

.line {
    padding: 4px 0;
    overflow-wrap: anywhere;
}

.line .ts {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    margin-right: 6px;
}

.line .who {
    font-weight: 600;
    margin-right: 4px;
}

.line .pending {
    color: var(--muted);
    font-style: italic;
}

.logo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

/* live progress */
.progress {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--panel);
    margin-bottom: 12px;
    font-size: 13px;
}

.progress .big {
    font-weight: 700;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.progress.live {
    border-color: var(--red);
}

.progress.catching-up {
    border-color: #f59e0b;
}

.progress.done {
    border-color: var(--green);
}

.progress.done .big {
    color: var(--green);
}

.lag-bar {
    flex: 1;
    min-width: 120px;
    height: 6px;
    border-radius: 3px;
    background: var(--panel-2);
    overflow: hidden;
}

.lag-bar > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--green), #f59e0b, var(--red));
    transition: width 0.4s;
}

.view-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.view-bar .status-row {
    margin: 0;
}

.tabs {
    display: inline-flex;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px;
}

.tab {
    background: transparent;
    border: 0;
    color: var(--muted);
    font: inherit;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.tab.active {
    background: var(--panel-2);
    color: var(--text);
}

.markdown {
    white-space: pre-wrap;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
    margin: 0;
}

.line.speaking .text,
.line.pending .text {
    color: var(--muted);
    font-style: italic;
}

.line.speaking .text::before {
    content: '🎙 ';
}

.line.error .text {
    color: var(--red);
}

@keyframes blink {
    50% {
        opacity: 0.35;
    }
}

.line.speaking .text {
    animation: blink 1.2s infinite;
}
