* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #0f1419;
    color: #e7ecf1;
    line-height: 1.5;
}

a {
    color: #5eb8ff;
}

.topbar {
    background: #121a24;
    border-bottom: 1px solid #2a3f52;
}

.topbar-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 0.35rem;
}

.nav-link {
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    text-decoration: none;
    color: #8ba3b8;
    font-size: 0.92rem;
}

.nav-link:hover {
    background: #1e2a38;
    color: #e7ecf1;
}

.nav-link.active {
    background: #0d3b4c;
    color: #fff;
}

.page {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.page-title {
    margin: 0 0 0.35rem;
    font-size: 1.35rem;
}

.page-desc {
    margin: 0 0 1.5rem;
    color: #8ba3b8;
    font-size: 0.95rem;
}

.card {
    background: #16202a;
    border: 1px solid #2a3f52;
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.card h2 {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 600;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 720px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: #8ba3b8;
    margin-bottom: 0.85rem;
}

input[type="text"],
input[type="tel"],
input[type="password"],
input[type="number"],
select,
textarea {
    padding: 0.55rem 0.65rem;
    border: 1px solid #2a3f52;
    border-radius: 6px;
    background: #0f1419;
    color: #e7ecf1;
    font-size: 0.95rem;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid #2a3f52;
    border-radius: 6px;
    background: #1e2a38;
    color: #e7ecf1;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    background: #263545;
}

.btn-primary {
    background: #0d6e8a;
    border-color: #0d6e8a;
}

.btn-primary:hover {
    background: #0a5870;
}

.btn-success {
    background: #1a6b3c;
    border-color: #1a6b3c;
}

.btn-danger {
    background: #8b2e2e;
    border-color: #8b2e2e;
}

.btn-lg {
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.empty {
    color: #6a8299;
    font-size: 0.9rem;
    margin: 0;
}

.queue-count {
    display: inline-block;
    min-width: 1.5rem;
    padding: 0.1rem 0.45rem;
    background: #0d6e8a;
    border-radius: 999px;
    font-size: 0.8rem;
    text-align: center;
}

.queue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #2a3f52;
}

.queue-item:last-child {
    border-bottom: none;
}

.call-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 1rem;
    margin: 0;
    font-size: 0.9rem;
}

.call-meta dt {
    color: #8ba3b8;
}

.call-meta dd {
    margin: 0;
}

.status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.status-queued { background: #5c4a00; }
.status-active { background: #1a6b3c; }
.status-connecting_agent { background: #0d6e8a; }
.status-completed { background: #3a4450; }
.status-ended { background: #3a4450; }

.call-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 0.35rem;
    border: 1px solid transparent;
}

.call-row:hover {
    background: #1e2a38;
}

.call-row.selected {
    border-color: #0d6e8a;
    background: #1a2835;
}

.hidden {
    display: none !important;
}

.hint {
    font-size: 0.85rem;
    color: #8ba3b8;
    margin: 0 0 0.75rem;
}

.section-label {
    font-size: 0.8rem;
    color: #8ba3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 1rem 0 0.5rem;
}

.form-inline {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.form-inline input {
    flex: 1;
    min-width: 160px;
}

.stats-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.stat {
    background: #0f1419;
    border: 1px solid #2a3f52;
    border-radius: 8px;
    padding: 0.65rem 1rem;
    min-width: 100px;
}

.stat strong {
    display: block;
    font-size: 1.25rem;
}

.stat span {
    font-size: 0.8rem;
    color: #8ba3b8;
}

.table-wrap {
    overflow-x: auto;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

table.data th,
table.data td {
    text-align: left;
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid #2a3f52;
}

table.data th {
    color: #8ba3b8;
    font-weight: 500;
}

.badge {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.badge-pending { background: #3a4450; }
.badge-calling { background: #0d6e8a; }
.badge-done { background: #1a6b3c; }
.badge-failed { background: #8b2e2e; }

.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: #1e2a38;
    border: 1px solid #2a3f52;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    max-width: 320px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.card-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.card-toolbar h2 {
    margin: 0;
}

.filter-label {
    margin-bottom: 0;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.filter-label select {
    min-width: 140px;
}

.optional {
    color: #6a8299;
    font-weight: normal;
}

.verification-info {
    background: #0f1419;
    border: 1px solid #1a6b3c;
    padding: 0.65rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.settings-status {
    padding: 0.65rem 0.85rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.settings-status.ok {
    background: rgba(26, 107, 60, 0.2);
    border: 1px solid #1a6b3c;
}

.settings-status.warn {
    background: rgba(139, 46, 46, 0.2);
    border: 1px solid #8b2e2e;
}

.softphone-panel {
    margin-bottom: 1rem;
}

.softphone-panel.hidden {
    display: none;
}

.softphone-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.softphone-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #6a8299;
    flex-shrink: 0;
}

.softphone-dot-off {
    background: #6a8299;
}

.softphone-dot-on {
    background: #2ecc71;
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.6);
}

.softphone-dot-wait {
    background: #f39c12;
    animation: softphone-pulse 1.2s ease-in-out infinite;
}

.softphone-dot-busy {
    background: #3498db;
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.5);
}

.softphone-dot-error {
    background: #e74c3c;
}

@keyframes softphone-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.softphone-ext-label {
    margin-left: 0.5rem;
    color: #6a8299;
    font-size: 0.85rem;
    font-weight: normal;
}

.softphone-ext-label code {
    color: #8ec5ff;
}

#softphone-status {
    margin: 0.25rem 0 0;
}

.btn-sm {
    font-size: 0.85rem;
    padding: 0.35rem 0.65rem;
    margin-left: auto;
}
