/* Ringavelle console — logo, colour, and chrome from the design package. */

::selection {
    background: rgba(20, 184, 166, 0.28);
}

body {
    font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
    font-family: inherit;
}

code, .uuid-cell, .font-mono, .logs-output {
    font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

/* Sidebar is always the navy brand panel */
.sidebar {
    width: 256px;
    background: var(--sidebar, #122037);
    color: #e2e8f0;
    border-right: 1px solid var(--sidebar-border, #1e3148);
}

.sidebar-header {
    display: block;
    padding: 28px 24px 22px;
    border-bottom: 1px solid var(--sidebar-border, #1e3148);
}

.brand-lockup {
    display: block;
    line-height: 0;
}

.brand-logo {
    height: 36px;
    width: auto;
    max-width: 100%;
    display: block;
    user-select: none;
}

.brand-tagline {
    margin: 10px 0 0 2px;
    font-size: 11px;
    letter-spacing: 0.02em;
    color: #94a3b8;
}

.sidebar-nav {
    padding: 18px 12px;
}

.nav-label {
    margin: 0 12px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #64748b;
}

.sidebar .nav-item {
    gap: 12px;
    margin: 2px 0;
    padding: 10px 12px;
    border-left: none;
    border-radius: 12px;
    color: #cbd5e1;
    font-weight: 500;
}

.sidebar .nav-item > span:nth-child(2) {
    flex: 1;
}

.sidebar .nav-item-icon {
    width: 16px;
    height: 16px;
    color: currentColor;
}

.sidebar .nav-item-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

.sidebar .nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.sidebar .nav-item.active {
    background: rgba(20, 184, 166, 0.15);
    color: #5eead4;
}

.nav-live {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #5eead4;
}

.nav-live::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #2dd4bf;
    animation: rv-pulse 1.4s ease-in-out infinite;
}

@keyframes rv-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--sidebar-border, #1e3148);
}

.theme-switch-wrap {
    margin: 0 4px 10px;
    padding: 6px 8px;
    border: none;
    border-radius: 12px;
    color: #cbd5e1;
}

.theme-switch-wrap span {
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 500;
}

.theme-switch {
    background: rgba(255, 255, 255, 0.12);
    border-color: transparent;
}

.theme-switch.on {
    background: #14b8a6;
    border-color: #14b8a6;
}

.sidebar-user {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px;
    cursor: default;
}

.sidebar-user:hover {
    background: rgba(255, 255, 255, 0.08);
}

.user-avatar {
    background: #14b8a6;
    color: #0f172a;
    font-weight: 800;
}

.sidebar .user-name {
    color: #fff;
}

.sidebar .user-role {
    color: #94a3b8;
    font-size: 12px;
}

.sidebar #logout-btn,
.sidebar .btn-link {
    color: #94a3b8;
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.sidebar #logout-btn:hover,
.sidebar .btn-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Page canvas */
.main-content {
    background: var(--bg-primary);
}

.content-header,
.calls-page .content-header-compact,
.inbound-ai-page .content-header-compact {
    background: transparent;
    border-bottom: none;
}

.content-header {
    padding: 36px 40px 0;
}

.content-header h1,
.calls-page .content-header-compact h1,
.inbound-ai-page .content-header-compact h1 {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.content-subtitle,
.calls-page .content-header-compact .content-subtitle,
.inbound-ai-page .content-header-compact .content-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

.content-body,
.calls-page .content-body-compact,
.inbound-ai-page .content-body-compact {
    padding: 22px 40px 40px;
}

.card,
.table-container,
.stat-card,
.logs-panel,
.active-calls-section {
    border-radius: 16px;
}

.table thead,
.table th {
    background: color-mix(in srgb, var(--bg-tertiary) 70%, transparent);
}

.table th {
    font-size: 11px;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--text-secondary);
}

.table tbody tr:hover {
    background: rgba(20, 184, 166, 0.05);
}

.btn,
.btn-primary,
.btn-secondary,
.filter-btn,
.pagination button,
.form-input,
.search-input {
    font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
    border-radius: 12px;
}

.btn-primary {
    background: #14b8a6;
    color: #0f172a;
    border: none;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.btn-primary:hover {
    background: #2dd4bf;
    color: #0f172a;
    transform: translateY(-1px);
}

.calls-page .filters-compact,
.filters {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 4px;
    gap: 2px;
}

.filter-btn {
    border: none;
    background: transparent;
    border-radius: 8px;
}

.filter-btn.active {
    background: #122037;
    color: #fff;
    border-color: transparent;
}

html:not(.theme-light) .filter-btn.active {
    background: #14b8a6;
    color: #0f172a;
}

.search-input,
.form-input {
    background: var(--card-bg);
    border-radius: 12px;
    min-height: 42px;
}

.search-input:focus,
.form-input:focus {
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.28);
}

.badge {
    border-radius: 999px;
    border: 1px solid transparent;
    letter-spacing: 0.04em;
    font-size: 11px;
}

.badge-success {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.badge-warning {
    background: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

.badge-error {
    background: #fff1f2;
    color: #be123c;
    border-color: #fecdd3;
}

.badge-info {
    background: #f0fdfa;
    color: #0f766e;
    border-color: #99f6e4;
}

html:not(.theme-light) .badge-success {
    background: rgba(6, 78, 59, 0.45);
    color: #6ee7b7;
    border-color: rgba(6, 95, 70, 0.7);
}

html:not(.theme-light) .badge-warning {
    background: rgba(120, 53, 15, 0.4);
    color: #fcd34d;
    border-color: rgba(146, 64, 14, 0.6);
}

html:not(.theme-light) .badge-error {
    background: rgba(136, 19, 55, 0.45);
    color: #fda4af;
    border-color: rgba(159, 18, 57, 0.7);
}

html:not(.theme-light) .badge-info {
    background: rgba(19, 78, 74, 0.45);
    color: #5eead4;
    border-color: rgba(17, 94, 89, 0.7);
}

.modal {
    background: rgba(15, 23, 42, 0.55);
}

.modal-content {
    border-radius: 16px;
}

.dashboard-section,
.agents-section,
.recordings-section,
.agents-stats .stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
}

.dashboard-section h2,
.page-header h2 {
    font-size: 16px;
    margin: 0 0 12px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.agents-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.agents-grid,
.recordings-grid,
.agent-grid,
.calls-list,
.transcription-feed {
    display: grid;
    gap: 10px;
}

/* Live dashboard */
.ld-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.ld-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.ld-stat {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
}

.ld-stat-accent {
    border-color: rgba(20, 184, 166, 0.4);
    background: rgba(20, 184, 166, 0.06);
}

.ld-stat .wp-eyebrow {
    margin: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.ld-stat-value {
    margin: 10px 0 0;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
}

.ld-stat-sub {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.ld-layout {
    display: grid;
    gap: 24px;
}

@media (min-width: 1100px) {
    .ld-layout {
        grid-template-columns: 1.25fr 0.85fr;
        align-items: start;
    }
}

.ld-title {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 600;
}

.ld-main .ld-title + .ld-ext-grid,
.ld-calls + .ld-title {
    margin-top: 28px;
}

.ld-calls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ld-call {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
}

.ld-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 24px;
}

.ld-bars span {
    width: 3px;
    height: 100%;
    border-radius: 99px;
    background: #14b8a6;
    transform-origin: bottom;
    animation: rv-bar 900ms ease-in-out infinite;
}

.ld-bars span:nth-child(2) { animation-delay: 120ms; }
.ld-bars span:nth-child(3) { animation-delay: 240ms; }
.ld-bars span:nth-child(4) { animation-delay: 360ms; }
.ld-bars span:nth-child(5) { animation-delay: 480ms; }

@keyframes rv-bar {
    0%, 100% { transform: scaleY(0.3); }
    50% { transform: scaleY(1); }
}

.ld-call-main {
    flex: 1;
    min-width: 0;
}

.ld-call-route {
    margin: 0;
    font-weight: 600;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.ld-arrow {
    color: var(--text-muted);
}

.ld-call-meta {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.ld-timer {
    font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
    font-weight: 600;
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 6px 12px;
}

.ld-ext-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.ld-ext {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    background: var(--card-bg);
}

.ld-ext-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ld-ext b {
    font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
    font-size: 18px;
}

.ld-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
}

.ld-ext.online .ld-dot,
.ld-ext.on-call .ld-dot {
    background: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}

.ld-ext p {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.ld-transcript {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    min-height: 280px;
    display: flex;
    flex-direction: column;
}

.ld-transcript-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 0;
}

.ld-transcript-head .ld-title {
    margin: 0;
}

.transcription-feed {
    padding: 16px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.transcription-entry {
    display: flex;
    gap: 12px;
    font-size: 14px;
}

.transcription-entry .timestamp {
    font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
    padding-top: 2px;
}

@media (max-width: 720px) {
    .ld-stats {
        grid-template-columns: 1fr;
    }
}

/* Webphone — trunk bar and route cards */
.wp-stack {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.wp-trunk,
.wp-route {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
}

.wp-trunk {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 24px;
    padding: 24px;
}

.wp-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: rgba(20, 184, 166, 0.15);
    color: #0f766e;
    flex-shrink: 0;
}

html:not(.theme-light) .wp-icon {
    color: #5eead4;
}

.wp-trunk-copy {
    flex: 1;
    min-width: 180px;
}

.wp-trunk-copy h2,
.wp-route-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.wp-trunk-copy p {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.wp-meta .wp-eyebrow,
.wp-exts .wp-eyebrow {
    margin: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.wp-meta p {
    margin: 2px 0 0;
    font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
    font-size: 14px;
}

.wp-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    border: 1px solid transparent;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.wp-pill i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.wp-pill.on {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.wp-pill.off {
    background: #f1f5f9;
    color: #475569;
    border-color: #e2e8f0;
}

html:not(.theme-light) .wp-pill.on {
    background: rgba(6, 78, 59, 0.45);
    color: #6ee7b7;
    border-color: rgba(6, 95, 70, 0.7);
}

html:not(.theme-light) .wp-pill.off {
    background: rgba(30, 41, 59, 0.7);
    color: #cbd5e1;
    border-color: #334155;
}

.wp-grid {
    display: grid;
    gap: 24px;
}

@media (min-width: 1100px) {
    .wp-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.wp-route {
    overflow: hidden;
}

.wp-route-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--bg-tertiary) 55%, transparent);
}

.wp-route-head svg {
    color: #14b8a6;
    flex-shrink: 0;
}

.wp-route-head h2 {
    font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
    font-size: 18px;
}

.wp-route-head span {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-secondary);
}

.wp-exts {
    padding: 20px 24px;
}

.wp-ext-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.wp-ext {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px 12px;
}

.wp-ext b {
    font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

.wp-ext em {
    font-style: normal;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.wp-rows {
    border-top: 1px solid var(--border-color);
}

.wp-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 16px;
    align-items: center;
    padding: 12px 24px;
    font-size: 14px;
    border-top: 1px solid var(--border-color);
}

.wp-row:first-child {
    border-top: none;
}

.wp-row dt {
    color: var(--text-secondary);
}

.wp-row dd {
    margin: 0;
    min-width: 0;
}

.wp-mono {
    font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

.wp-key {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.wp-key code {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
}

.wp-icon-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.wp-icon-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.wp-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    background: #122037;
    color: #fff;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
    z-index: 50;
}

/* Login */
.login-split {
    display: grid;
    min-height: 100vh;
    grid-template-columns: 1.05fr 1fr;
}

.login-hero {
    position: relative;
    overflow: hidden;
    background: #122037;
    color: #fff;
    padding: 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.login-hero .brand-logo {
    height: 44px;
    position: relative;
}

.login-ring {
    pointer-events: none;
    position: absolute;
    border-radius: 50%;
    border: 56px solid rgba(20, 184, 166, 0.1);
}

.login-ring.a {
    width: 520px;
    height: 520px;
    right: -160px;
    top: -160px;
}

.login-ring.b {
    width: 460px;
    height: 460px;
    left: -96px;
    bottom: -208px;
    border-width: 40px;
    border-color: rgba(20, 184, 166, 0.07);
}

.login-kicker {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #5eead4;
}

.login-hero h1 {
    margin: 16px 0 0;
    font-size: 48px;
    line-height: 1.1;
    letter-spacing: -0.03em;
    font-weight: 700;
    color: #fff;
}

.login-points {
    list-style: none;
    margin: 40px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-points li {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #cbd5e1;
}

.login-points span {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(20, 184, 166, 0.15);
    color: #5eead4;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.login-fine {
    position: relative;
    font-size: 12px;
    color: #64748b;
}

.login-panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 64px 24px;
}

.login-panel-inner {
    width: 100%;
    max-width: 380px;
}

.login-panel h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.login-panel .lede {
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.login-actions {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sso-btn {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.sso-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(20, 184, 166, 0.6);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    color: var(--text-primary);
}

.login-theme-toggle {
    position: absolute;
    right: 24px;
    top: 24px;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.login-theme-toggle:hover {
    background: var(--bg-tertiary);
}

.login-theme-toggle::after {
    display: none;
}

html.theme-light .icon-sun,
html:not(.theme-light) .icon-moon {
    display: none;
}

.login-mobile-logo {
    display: none;
    height: 40px;
    margin-bottom: 40px;
}

html:not(.theme-light) .logo-for-light,
html.theme-light .logo-for-dark {
    display: none;
}

/* Mobile bar */
.mobile-bar {
    display: none;
}

@media (max-width: 960px) {
    .login-split {
        grid-template-columns: 1fr;
    }
    .login-hero {
        display: none;
    }
    .login-mobile-logo {
        display: block;
    }
    .mobile-bar {
        display: flex;
        position: sticky;
        top: 0;
        z-index: 40;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
        background: color-mix(in srgb, var(--bg-primary) 88%, transparent);
        border-bottom: 1px solid var(--border-color);
        backdrop-filter: blur(10px);
    }
    .mobile-bar img {
        height: 28px;
        width: auto;
    }
    .mobile-bar button {
        border: none;
        background: transparent;
        color: var(--text-primary);
        border-radius: 8px;
        padding: 8px;
        cursor: pointer;
    }
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        min-height: 100vh;
    }
    .sidebar.open {
        transform: none;
        box-shadow: 16px 0 40px rgba(0, 0, 0, 0.25);
    }
    .content-header,
    .content-body,
    .calls-page .content-body-compact,
    .inbound-ai-page .content-body-compact {
        padding-left: 16px;
        padding-right: 16px;
    }
}
