﻿:root {
    --sp-bg: #f5f7fb;
    --sp-surface: #ffffff;
    --sp-surface-soft: #f9fafb;
    --sp-surface-warm: #fff8f2;
    --sp-border: #e7ecf4;
    --sp-text: #111827;
    --sp-muted: #6b7280;
    --sp-brand: #ff7a1a;
    --sp-brand-deep: #e86507;
    --sp-blue: #2563eb;
    --sp-purple: #7c3aed;
    --sp-green: #10b981;
    --sp-cyan: #06b6d4;
    --sp-danger: #ef4444;
    --sp-sidebar-width: 250px;
    --sp-radius-lg: 18px;
    --sp-radius-md: 14px;
    --sp-radius-sm: 10px;
    --sp-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--sp-bg);
    color: var(--sp-text);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

h1, h2, h3, p {
    margin-top: 0;
}

a {
    color: inherit;
}

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

textarea {
    resize: vertical;
}

.sp-auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px;
    background: linear-gradient(180deg, #f7f8fb 0%, #f2f5fa 100%);
}

.sp-auth-center {
    width: 100%;
    display: grid;
    place-items: center;
}

.sp-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sp-sidebar-width) 1fr;
}

.sp-guest-shell {
    min-height: 100vh;
    padding: 24px;
    overflow: hidden;
}

.sp-guest-brand {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 14px;
    align-items: center;
    width: fit-content;
    margin-bottom: 20px;
    padding: 8px 0;
}

.guest-ticket-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0;
    gap: 24px;
}

.sp-guest-ticket-header-main {
    display: flex;
    align-items: center;
    gap: 28px;
    min-width: 0;
}

.sp-guest-ticket-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.sp-guest-ticket-info {
    min-width: 0;
}

.sp-guest-ticket-info h1 {
    margin: 0 0 4px;
}

.sp-guest-ticket-info .sp-lead {
    margin: 0;
}

.sp-sidebar {
    background: var(--sp-surface);
    border-right: 1px solid var(--sp-border);
    padding: 0 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sp-sidebar-brand {
    background: var(--sp-surface-warm);
    margin: 0 -14px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--sp-border);
}

.sp-sidebar-brand-top {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 14px;
    align-items: center;
}

.sp-brand-logo {
    width: 56px;
    height: 56px;
    display: block;
    object-fit: contain;
    padding: 0;
    background: transparent;
    border-radius: 0;
}

.sp-sidebar-title {
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--sp-text);
}

.sp-brand-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sp-beta-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: #fff1e8;
    color: var(--sp-brand);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.sp-sidebar-subtitle {
    color: var(--sp-muted);
    font-size: 0.95rem;
}

.sp-nav {
    display: grid;
    gap: 10px;
}

.sp-nav-group {
    display: grid;
    gap: 8px;
}

.sp-nav-group-title {
    padding: 10px 10px 6px;
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: #9ca3af;
}

.sp-nav-link {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 42px;
    text-decoration: none;
    color: #4b5563;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.sp-nav-link.active,
.sp-nav-link:hover,
.sp-nav-link.button-link:hover {
    background: #fff1e8;
    color: var(--sp-brand);
}

.sp-nav-link.button-link {
    border: 0;
}

.sp-sidebar-user {
    margin-top: auto;
    background: var(--sp-surface-soft);
    border: 1px solid var(--sp-border);
    border-radius: 16px;
    padding: 14px 16px;
    display: grid;
    gap: 4px;
}

.sp-sidebar-user-label {
    color: #9ca3af;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sp-sidebar-user strong {
    font-size: 1rem;
}

.sp-sidebar-user span:last-child {
    color: var(--sp-muted);
    font-size: 0.95rem;
}

.sp-shell-main {
    min-width: 0;
}

.sp-topbar {
    background: var(--sp-surface);
    border-bottom: 1px solid var(--sp-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 0 22px;
}

.sp-topbar-left,
.sp-topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.sp-topbar-menu {
    border: 0;
    background: transparent;
    color: #6b7280;
    font-size: 1.1rem;
    cursor: pointer;
}

.sp-topbar-search {
    width: min(320px, 36vw);
}

.sp-topbar-search input {
    width: 100%;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--sp-border);
    background: var(--sp-surface-soft);
    padding: 0 14px;
    color: var(--sp-text);
}

.sp-topbar-right {
    color: var(--sp-muted);
    font-size: 0.95rem;
}

.sp-topbar-right a {
    text-decoration: none;
}

.sp-topbar-icon {
    font-size: 1rem;
}

.sp-topbar-avatar {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sp-brand), var(--sp-brand-deep));
    color: white;
    font-size: 0.78rem;
    font-weight: 700;
}

.sp-main {
    padding: 26px;
    min-width: 0;
}

.sp-login-panel,
.sp-stat-card,
.sp-panel,
.sp-chat-window,
.sp-chat-list,
.sp-modal {
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius-lg);
    box-shadow: var(--sp-shadow);
}

.sp-login-panel,
.sp-stat-card,
.sp-panel,
.sp-chat-window,
.sp-chat-list,
.sp-modal {
    padding: 24px;
}

.sp-login-panel.compact {
    width: min(760px, 100%);
}

.branded-login {
    background: linear-gradient(180deg, #ffffff 0%, #fdfdfc 100%);
}

.sp-login-brand {
    display: grid;
    grid-template-columns: 84px 1fr;
    gap: 18px;
    align-items: center;
    margin-bottom: 18px;
}

.sp-public-request-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.report-modal-actions {
    justify-content: flex-end;
    margin-top: 28px;
}

.sp-login-logo {
    width: 84px;
    height: 84px;
    display: block;
    object-fit: contain;
    padding: 0;
    background: transparent;
    border-radius: 0;
}

.sp-page-head,
.sp-section-head,
.sp-modal-head,
.sp-login-actions,
.sp-modal-actions,
.sp-activity-top,
.sp-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.sp-page-head {
    margin-bottom: 22px;
}

.sp-page-head h1 {
    font-size: clamp(2rem, 2.8vw, 2.65rem);
    margin-bottom: 6px;
}

.sp-login-title {
    margin: 0;
}

.sp-lead,
.sp-stat-help,
.sp-hint,
.sp-empty-chat,
.sp-message-meta,
.sp-translation-note,
.sp-profile-list span,
.sp-sidebar-note,
.sp-message-history-item span {
    color: var(--sp-muted);
}

.sp-page-actions,
.sp-login-actions,
.sp-modal-actions,
.sp-inline-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.sp-login-actions.between {
    justify-content: space-between;
    align-items: center;
}

.sp-login-actions.login-submit {
    justify-content: flex-end;
}

.sp-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 24px;
}

.sp-grid.four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sp-grid.split {
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

.sp-grid.split-admin {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sp-stat-card {
    position: relative;
    overflow: hidden;
}

.sp-stat-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--sp-blue);
}

.sp-grid.four .sp-stat-card:nth-child(2)::before {
    background: var(--sp-purple);
}

.sp-grid.four .sp-stat-card:nth-child(3)::before {
    background: var(--sp-green);
}

.sp-grid.four .sp-stat-card:nth-child(4)::before {
    background: var(--sp-cyan);
}

.sp-stat-label {
    color: var(--sp-blue);
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.sp-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--sp-text);
    margin-bottom: 10px;
    word-break: break-word;
}

.sp-form-grid {
    display: grid;
    gap: 16px;
    margin: 18px 0;
}

.sp-form-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sp-form-grid label {
    display: grid;
    gap: 8px;
    color: var(--sp-text);
    font-weight: 600;
}

.sp-form-action-tile {
    display: grid;
    align-content: end;
    gap: 10px;
}

.sp-form-action-label {
    color: var(--sp-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.sp-form-grid input,
.sp-form-grid select,
.sp-form-grid textarea,
.sp-chat-input,
.sp-history-search,
.sp-topbar-search input {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #ffffff;
    color: var(--sp-text);
    width: 100%;
    padding: 12px 14px;
    outline: none;
}

.sp-form-grid input:focus,
.sp-form-grid select:focus,
.sp-form-grid textarea:focus,
.sp-chat-input:focus,
.sp-history-search:focus,
.sp-topbar-search input:focus {
    border-color: #cbd5e1;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.sp-primary,
.sp-secondary,
.sp-inline,
.sp-icon-button,
.sp-chat-composer button {
    min-height: 42px;
    border-radius: 10px;
    border: 1px solid transparent;
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 600;
}

.sp-primary {
    background: var(--sp-brand);
    color: #ffffff;
}

.sp-primary:hover {
    background: var(--sp-brand-deep);
}

.sp-secondary {
    background: #fff1e8;
    color: #c15a0b;
    border-color: #f4d2ba;
}

.sp-inline,
.sp-icon-button {
    background: #f9fafb;
    color: #374151;
    border-color: var(--sp-border);
}

.sp-inline.danger {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.sp-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.sp-table thead th {
    color: #9ca3af;
    font-size: 0.86rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    padding: 0 14px 8px;
    border: 0;
}

.sp-table tbody tr {
    background: var(--sp-surface-soft);
}

.sp-table tbody td {
    padding: 16px 14px;
    border-top: 1px solid #eef2f7;
    border-bottom: 1px solid #eef2f7;
}

.sp-table tbody td:first-child {
    border-left: 1px solid #eef2f7;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.sp-table tbody td:last-child {
    border-right: 1px solid #eef2f7;
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.sp-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.sp-status-badge.is-new {
    background: #ecfdf5;
    color: #047857;
}

.sp-status-badge.is-waiting {
    background: #fff7ed;
    color: #c2410c;
}

.sp-status-badge.is-neutral {
    background: #eff6ff;
    color: #2563eb;
}

.sp-tier {
    color: #c15a0b;
    font-weight: 700;
}

.sp-profile-list,
.sp-check-list,
.sp-message-history-list,
.sp-activity-grid {
    display: grid;
    gap: 14px;
}

.sp-profile-list div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--sp-border);
}

.sp-chat-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 20px;
}

.sp-chat-shell.simplified-chat {
    grid-template-columns: 1fr;
}

.sp-chat-list {
    align-content: start;
}

.sp-chat-item {
    padding: 14px;
    border-radius: 12px;
    background: var(--sp-surface-soft);
}

.sp-chat-item.active {
    color: var(--sp-brand);
    border: 1px solid #ffd7bb;
    background: #fff6f0;
    font-weight: 700;
}

.sp-chat-window {
    height: calc(100vh - 260px);
    min-height: calc(100vh - 260px);
    max-height: calc(100vh - 260px);
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto;
    gap: 16px;
}

.sp-chat-window.guest-chat-window {
    height: calc(100vh - 260px);
    min-height: calc(100vh - 260px);
    max-height: calc(100vh - 260px);
}

.sp-chat-scroll {
    overflow-y: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sp-assignment-note {
    margin: 0 0 16px 0;
}

.sp-message {
    max-width: min(74%, 680px);
    padding: 14px 16px;
    border-radius: 16px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.sp-message.inbound {
    background: #f9fafb;
}

.sp-message.outbound {
    margin-left: auto;
    background: #fff1e8;
}

.sp-message-body {
    white-space: pre-wrap;
    line-height: 1.55;
}

.sp-chat-composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    gap: 12px;
    align-items: center;
    border-top: 1px solid var(--sp-border);
    padding-top: 16px;
}

.sp-chat-input {
    min-height: 56px;
    max-height: 56px;
}

.sp-chat-assignee {
    margin-top: 8px;
    color: var(--sp-text-soft);
    font-weight: 600;
}

.sp-chat-decision-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-top: 1px solid var(--sp-border);
    border-bottom: 1px solid var(--sp-border);
    padding: 14px 0;
}

.sp-chat-composer button {
    height: 56px;
    background: var(--sp-brand);
    color: white;
}

.sp-message-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: #dbeafe;
    color: var(--sp-blue);
    font-size: 0.8rem;
    font-weight: 700;
}

.sp-empty-chat {
    min-height: 120px;
    display: grid;
    place-items: center;
    border: 1px dashed #dbe3ef;
    border-radius: 14px;
    text-align: center;
    padding: 24px;
}

.sp-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.25);
    display: grid;
    place-items: center;
    padding: 24px;
    z-index: 30;
}

.sp-modal {
    width: min(980px, 100%);
    max-height: 88vh;
    overflow-y: auto;
}

.sp-modal.objection {
    width: min(700px, 100%);
}

.sp-alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
}

.sp-alert.success {
    background: #ecfdf5;
    color: #047857;
}

.sp-alert.error {
    background: #fef2f2;
    color: #b91c1c;
}

.sp-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: grid;
    gap: 12px;
    max-width: min(380px, calc(100vw - 32px));
}

.sp-toast {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--sp-border);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
    background: #ffffff;
    color: var(--sp-text);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.sp-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.sp-toast-success {
    border-left: 4px solid var(--sp-green);
}

.sp-toast-error {
    border-left: 4px solid var(--sp-danger);
}

.sp-toast-warning {
    border-left: 4px solid #f59e0b;
}

.sp-toast-info {
    border-left: 4px solid var(--sp-blue);
}

.sp-toast-body {
    line-height: 1.45;
    white-space: pre-wrap;
}

.sp-toast-close {
    border: 0;
    background: transparent;
    color: #9ca3af;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.sp-history-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.sp-history-search {
    width: min(360px, 100%);
}

.sp-pagination {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.sp-message-history-list {
    max-height: 420px;
    overflow-y: auto;
}

.sp-message-history-item {
    padding: 14px 16px;
    border: 1px solid var(--sp-border);
    border-radius: 12px;
    background: var(--sp-surface-soft);
}

.sp-message-history-item p {
    margin: 0;
}

.sp-token-note,
.sp-objection-card,
.sp-activity-card {
    padding: 16px;
    border: 1px solid var(--sp-border);
    border-radius: 14px;
    background: var(--sp-surface-soft);
}

.sp-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 12px 0 18px;
}

.sp-checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--sp-muted);
}

.sp-tab-strip {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.sp-tab {
    border: 1px solid var(--sp-border);
    background: var(--sp-surface-soft);
    color: var(--sp-muted);
    border-radius: 10px;
    padding: 10px 18px;
    cursor: pointer;
}

.sp-tab.active {
    background: var(--sp-brand);
    color: white;
    border-color: var(--sp-brand);
}

.sp-full {
    grid-column: 1 / -1;
}

@media (max-width: 1024px) {
    .sp-grid.four,
    .sp-grid.split,
    .sp-grid.split-admin {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .sp-shell {
        grid-template-columns: 1fr;
    }

    .sp-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--sp-border);
    }

    .sp-topbar {
        padding: 14px 18px;
        flex-wrap: wrap;
    }

    .sp-topbar-search {
        width: 100%;
    }

    .sp-grid.four,
    .sp-grid.split,
    .sp-grid.split-admin,
    .sp-form-grid.two,
    .sp-chat-shell {
        grid-template-columns: 1fr;
    }

    .sp-main {
        padding: 18px;
    }

    .sp-chat-window {
        height: calc(100vh - 220px);
        min-height: calc(100vh - 220px);
        max-height: calc(100vh - 220px);
    }

    .sp-chat-decision-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 1366px) and (min-width: 861px) {
    :root {
        --sp-sidebar-width: 220px;
    }

    .sp-main {
        padding: 24px;
    }

    .sp-page-head {
        gap: 14px;
    }

    .sp-page-actions {
        gap: 8px;
    }

    .sp-page-actions .sp-primary,
    .sp-page-actions .sp-secondary {
        min-height: 38px;
        padding: 8px 12px;
        font-size: 0.88rem;
        white-space: nowrap;
    }

    .sp-stat-value {
        font-size: 1.6rem;
    }
}



