*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f1117;
    color: #e2e8f0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
}

.layout {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
}

.card {
    background: #1a1d27;
    border: 1px solid #2d3148;
    border-radius: 20px;
    padding: 48px 44px;
    text-align: center;
    width: 300px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

.lines-card, .selected-card {
    background: #1a1d27;
    border: 1px solid #2d3148;
    border-radius: 20px;
    padding: 28px 28px;
    width: 290px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
    display: flex;
    flex-direction: column;
}

.lines-card h2, .selected-card h2 {
    font-size: 13px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 14px;
    flex-shrink: 0;
}

/* ── Line items ── */

.line-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #12141e;
    border: 1px solid #252840;
    margin-bottom: 6px;
    transition: border-color .15s, background .15s;
    cursor: pointer;
    user-select: none;
}
.line-item:last-child { margin-bottom: 0; }

.line-item--available:hover {
    border-color: #22c55e55;
    background: #0c1a10;
}

.line-item--selected {
    border-color: #6366f144;
    background: #111428;
}
.line-item--selected:hover {
    border-color: #f8717166;
    background: #1c0d0d;
}

.line-id {
    font-size: 11px;
    font-weight: 700;
    color: #4b5280;
    background: #1e2138;
    padding: 2px 6px;
    border-radius: 6px;
    flex-shrink: 0;
}

.line-name {
    font-size: 13px;
    font-weight: 500;
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.line-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 20px;
    flex-shrink: 0;
}
.line-badge.active   { background: #14532d; color: #4ade80; }
.line-badge.inactive { background: #3b1212; color: #f87171; }

.line-action {
    font-size: 15px;
    font-weight: 700;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity .15s;
    line-height: 1;
}
.line-item:hover .line-action { opacity: 1; }
.line-action--add    { color: #22c55e; }
.line-action--remove { color: #f87171; }

/* ── Utility ── */

.lines-empty {
    font-size: 13px;
    color: #334155;
    text-align: center;
    padding: 16px 0;
}

.lines-error {
    font-size: 13px;
    color: #f87171;
    text-align: center;
    padding: 8px 0;
}

.lines-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    color: #475569;
    padding: 12px 0;
}

/* ── Bot control card ── */

.icon {
    font-size: 52px;
    margin-bottom: 18px;
    line-height: 1;
}

h1 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -.3px;
}

.status-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 32px;
    font-size: 14px;
    color: #94a3b8;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #64748b;
    transition: background .3s;
}
.dot.online { background: #22c55e; box-shadow: 0 0 8px #22c55e88; }

.status-text { transition: color .3s; }
.status-text.online { color: #22c55e; }

.btn {
    width: 100%;
    padding: 13px 0;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    position: relative;
    overflow: hidden;
}

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

.btn-start {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 4px 20px #6366f144;
}
.btn-start:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 28px #6366f166;
}

.btn-stop {
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: #fff;
    box-shadow: 0 4px 20px #ef444444;
}
.btn-stop:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 28px #ef444466;
}

.msg {
    margin-top: 16px;
    font-size: 13px;
    color: #64748b;
    min-height: 20px;
    transition: color .3s;
}
.msg.ok  { color: #22c55e; }
.msg.err { color: #f87171; }

.spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid #ffffff55;
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Show more ── */

.btn-more {
    width: 100%;
    padding: 8px 0;
    background: transparent;
    color: #6366f1;
    border: 1px solid #2d3148;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    margin-top: 6px;
}
.btn-more:hover {
    border-color: #6366f1;
    background: #13153a;
}

/* ── Save controls (inside selected-card) ── */

.lines-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid #252840;
    flex-shrink: 0;
}

.btn-save {
    padding: 8px 20px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}
.btn-save:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px #6366f155;
}
.btn-save:disabled { opacity: .6; cursor: not-allowed; }

.save-msg {
    font-size: 12px;
    color: #475569;
}
.save-msg.ok  { color: #22c55e; }
.save-msg.err { color: #f87171; }
