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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #0f1419;
    background-image: url('/static/background.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: #e2e8f0;
    min-height: 100vh;
}

body::before {
    content: ''; position: fixed; inset: 0;
    background: rgba(15, 20, 25, 0.78); z-index: -1;
}

body[data-theme="blue"]::before { background: rgba(10, 20, 40, 0.82); }
body[data-theme="emerald"]::before { background: rgba(8, 25, 18, 0.82); }

body[data-theme="emerald"] .card,
body[data-theme="emerald"] .sidebar,
body[data-theme="emerald"] .table-wrap,
body[data-theme="emerald"] .settings-block,
body[data-theme="emerald"] .modal,
body[data-theme="emerald"] .login-box,
body[data-theme="emerald"] .role-card,
body[data-theme="emerald"] .follow-up-card,
body[data-theme="emerald"] .call-card {
    background: rgba(18, 38, 28, 0.75);
    border-color: #2f5d45;
}

body[data-theme="emerald"] .btn-primary {
    background: rgba(72, 187, 120, 0.2);
    border-color: #48bb78;
    color: #9ae6b4;
}

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: rgba(15, 20, 25, 0.75);
    backdrop-filter: blur(10px);
    border-right: 1px solid #2d3748;
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    transition: transform 0.25s;
    z-index: 500;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 2px;
    padding: 0 8px 24px;
    color: #e2e8f0;
}

.sidebar nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.nav-item {
    padding: 10px 16px;
    border-radius: 8px;
    color: #718096;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.15s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-item:hover { background: rgba(26, 32, 40, 0.7); color: #e2e8f0; }
.nav-item.active { background: rgba(35, 43, 53, 0.9); color: #e2e8f0; border: 1px solid #2d3748; }

.nav-badge {
    background: #fc8181;
    color: white;
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 600;
}

.sidebar-footer { padding-top: 16px; border-top: 1px solid #2d3748; }

.main {
    flex: 1;
    padding: 40px;
    margin-left: 240px;
    width: calc(100% - 240px);
    max-width: calc(100% - 240px);
    box-sizing: border-box;
    overflow-x: hidden;
}

.hamburger {
    display: none;
    position: fixed;
    top: 16px; left: 16px;
    z-index: 600;
    background: rgba(26, 32, 40, 0.95);
    border: 1px solid #2d3748;
    border-radius: 8px;
    padding: 10px 14px;
    color: #e2e8f0;
    font-size: 22px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    font-family: inherit;
    line-height: 1;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 400;
}

.sidebar-overlay.active { display: block; }

.page-title {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 24px;
    color: #e2e8f0;
}

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

.page-header .page-title { margin-bottom: 0; }

.cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.card {
    background: rgba(26, 32, 40, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid #2d3748;
    border-radius: 12px;
    padding: 24px;
    transition: all 0.15s;
}

.card-label { font-size: 13px; color: #718096; margin-bottom: 8px; }
.card-value { font-size: 28px; font-weight: bold; color: #e2e8f0; }
.card-clickable { cursor: pointer; }
.card-clickable:hover { border-color: #4a90e2; transform: translateY(-2px); }

.card-hint {
    font-size: 11px;
    color: #4a90e2;
    margin-top: 12px;
    opacity: 0;
    transition: opacity 0.15s;
}

.card-clickable:hover .card-hint { opacity: 1; }

.subtitle {
    color: #718096;
    font-size: 14px;
    margin-bottom: 24px;
}

.details-panel {
    margin-top: 24px;
    background: rgba(26, 32, 40, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid #2d3748;
    border-radius: 12px;
    padding: 24px;
}

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

.details-header h3 { color: #e2e8f0; font-size: 18px; }
.details-body { color: #a0aec0; font-size: 14px; line-height: 1.7; }
.details-body ul { list-style: none; padding: 0; }
.details-body li { padding: 8px 0; border-bottom: 1px solid #2d3748; }
.details-body li:last-child { border-bottom: none; }

.chart-block {
    margin-top: 32px;
    background: rgba(26, 32, 40, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid #2d3748;
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
}

.chart-block h3 { color: #e2e8f0; font-size: 16px; margin-bottom: 20px; }

.btn {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    background: rgba(26, 32, 40, 0.7);
    border: 1px solid #2d3748;
    color: #e2e8f0;
    backdrop-filter: blur(8px);
    font-family: inherit;
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
}

.btn:hover { background: rgba(35, 43, 53, 0.9); border-color: #4a90e2; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: rgba(74, 144, 226, 0.2); border-color: #4a90e2; color: #90cdf4; }
.btn-primary:hover { background: rgba(74, 144, 226, 0.35); }
.btn-ghost { background: transparent; border: none; color: #718096; padding: 8px; }
.btn-ghost:hover { color: #e2e8f0; }
.btn-danger { background: rgba(252, 129, 129, 0.15); border-color: #fc8181; color: #fc8181; }
.btn-danger:hover { background: rgba(252, 129, 129, 0.3); border-color: #fc8181; }

.table-wrap {
    background: rgba(26, 32, 40, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid #2d3748;
    border-radius: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
}

.table { width: 100%; border-collapse: collapse; min-width: 900px; }

.table th {
    text-align: left;
    padding: 14px 16px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #718096;
    background: rgba(15, 20, 25, 0.5);
    border-bottom: 1px solid #2d3748;
    white-space: nowrap;
}

.table td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid #2d3748;
    color: #e2e8f0;
    white-space: nowrap;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(35, 43, 53, 0.5); }
.loading { text-align: center; color: #718096; padding: 32px; }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal {
    background: rgba(26, 32, 40, 0.98);
    border: 1px solid #2d3748;
    border-radius: 12px;
    padding: 28px;
    width: 480px;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal h3 { font-size: 18px; margin-bottom: 12px; color: #e2e8f0; }
.modal p { color: #a0aec0; font-size: 14px; margin-bottom: 20px; line-height: 1.5; }
.modal form { display: flex; flex-direction: column; gap: 12px; }
.modal label { font-size: 13px; color: #718096; margin-bottom: 4px; display: block; }

.modal input, .modal select, .modal textarea {
    background: rgba(15, 20, 25, 0.6);
    border: 1px solid #2d3748;
    border-radius: 8px;
    padding: 12px 14px;
    color: #e2e8f0;
    font-size: 14px;
    font-family: inherit;
    width: 100%;
}

.modal input:focus, .modal select:focus, .modal textarea:focus { outline: none; border-color: #4a90e2; }

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

.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }

.login-box {
    background: rgba(26, 32, 40, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid #2d3748;
    border-radius: 16px;
    padding: 48px;
    width: 380px;
    max-width: 100%;
    text-align: center;
}

.login-logo {
    font-size: 40px;
    font-weight: bold;
    letter-spacing: 4px;
    color: #e2e8f0;
    margin-bottom: 8px;
}

.login-sub { font-size: 13px; color: #718096; margin-bottom: 32px; }
.login-box form { display: flex; flex-direction: column; text-align: left; gap: 12px; }
.login-box label { font-size: 13px; color: #718096; margin-bottom: 2px; }

.login-box input {
    background: rgba(15, 20, 25, 0.6);
    border: 1px solid #2d3748;
    border-radius: 8px;
    padding: 12px 14px;
    color: #e2e8f0;
    font-size: 14px;
    font-family: inherit;
    width: 100%;
}

.login-box input:focus { outline: none; border-color: #4a90e2; }
.login-links { margin-top: 20px; }
.login-links a { color: #718096; font-size: 13px; text-decoration: none; }
.login-links a:hover { color: #90cdf4; }

.form-error {
    display: none;
    color: #fc8181;
    font-size: 13px;
    margin-top: 8px;
    line-height: 1.4;
    text-align: left;
    padding: 8px 12px;
    background: rgba(252, 129, 129, 0.1);
    border-radius: 6px;
    border-left: 3px solid #fc8181;
}

.drop-zone {
    background: rgba(26, 32, 40, 0.7);
    backdrop-filter: blur(8px);
    border: 2px dashed #2d3748;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    transition: all 0.2s;
}

.drop-zone-active { border-color: #4a90e2; background: rgba(74, 144, 226, 0.1); }
.drop-text { font-size: 18px; color: #e2e8f0; margin-bottom: 8px; }
.drop-sub { color: #718096; font-size: 13px; margin-bottom: 16px; }

.settings-block {
    background: rgba(26, 32, 40, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid #2d3748;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.settings-block * { max-width: 100%; box-sizing: border-box; }
.settings-block h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; color: #e2e8f0; }
.settings-status { font-size: 14px; color: #718096; margin-bottom: 8px; word-break: break-word; }
.settings-status span { color: #e2e8f0; }

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

.section-header h3 { margin-bottom: 0; }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: 14px; }
.info-grid .label { color: #718096; }
.info-grid > div { padding: 4px 0; min-width: 0; overflow-wrap: break-word; }

.text-block {
    color: #cbd5e0;
    font-size: 14px;
    line-height: 1.5;
    margin-top: 6px;
    white-space: pre-wrap;
    word-break: break-word;
}

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

.tag {
    background: rgba(74, 144, 226, 0.15);
    border: 1px solid #4a90e2;
    color: #90cdf4;
    border-radius: 12px;
    padding: 3px 10px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tag-x { cursor: pointer; opacity: 0.7; font-weight: bold; }
.tag-x:hover { opacity: 1; color: #fc8181; }
.tag-presets { display: flex; flex-wrap: wrap; gap: 6px; }

.tag-preset {
    background: transparent;
    border: 1px dashed #4a5568;
    color: #a0aec0;
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}

.tag-preset:hover { border-color: #4a90e2; color: #90cdf4; }

.priority { padding: 3px 10px; border-radius: 12px; font-size: 12px; }
.priority-high { background: rgba(252, 129, 129, 0.2); color: #fc8181; }
.priority-medium { background: rgba(237, 137, 54, 0.2); color: #f6ad55; }
.priority-low { background: rgba(160, 174, 192, 0.2); color: #a0aec0; }

.follow-up-list { display: flex; flex-direction: column; gap: 12px; }

.follow-up-card {
    background: rgba(15, 20, 25, 0.5);
    border: 1px solid #2d3748;
    border-left: 3px solid #4a90e2;
    border-radius: 8px;
    padding: 16px;
}

.follow-up-overdue { border-left-color: #fc8181; background: rgba(252, 129, 129, 0.05); }
.fu-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; flex-wrap: wrap; }
.fu-type { font-weight: 600; color: #90cdf4; font-size: 14px; }
.fu-date { font-size: 12px; color: #718096; }
.follow-up-overdue .fu-date { color: #fc8181; font-weight: 600; }
.fu-title { font-size: 15px; color: #e2e8f0; margin-bottom: 6px; }
.fu-reason { font-size: 13px; color: #a0aec0; margin-bottom: 12px; }
.fu-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fu-actions .btn { padding: 6px 12px; font-size: 13px; }

.timeline { display: flex; flex-direction: column; gap: 0; }

.tl-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #2d3748;
    overflow: hidden;
    word-break: break-word;
}

.tl-item:last-child { border-bottom: none; }

.tl-icon {
    width: 32px; height: 32px;
    flex-shrink: 0;
    background: rgba(74, 144, 226, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.tl-body { flex: 1; min-width: 0; overflow-wrap: break-word; }
.tl-title { font-size: 14px; color: #e2e8f0; font-weight: 500; margin-bottom: 4px; word-break: break-word; }

.tl-desc {
    font-size: 13px;
    color: #a0aec0;
    line-height: 1.5;
    margin-bottom: 4px;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
}

.tl-date { font-size: 12px; color: #718096; }

.clock-block {
    background: rgba(26, 32, 40, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid #2d3748;
    border-radius: 12px;
    padding: 32px 16px;
    margin-bottom: 24px;
    text-align: center;
}

.clock-time {
    font-size: 56px;
    font-weight: 300;
    color: #e2e8f0;
    letter-spacing: 2px;
    font-variant-numeric: tabular-nums;
    margin-bottom: 8px;
}

.clock-date {
    font-size: 16px;
    color: #a0aec0;
    margin-bottom: 8px;
    text-transform: capitalize;
}

.clock-tz { font-size: 12px; color: #718096; }

.roles-info { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }

.role-card {
    background: rgba(26, 32, 40, 0.7);
    border: 1px solid #2d3748;
    border-radius: 12px;
    padding: 20px;
}

.role-card h4 { color: #e2e8f0; font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.role-card ul { list-style: none; padding: 0; font-size: 13px; color: #a0aec0; line-height: 1.6; }
.role-card li::before { content: '• '; color: #4a90e2; }

.role-select {
    background: rgba(15, 20, 25, 0.6);
    border: 1px solid #2d3748;
    color: #e2e8f0;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
}

.role-select:focus { outline: none; border-color: #4a90e2; }

.theme-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }

.theme-btn {
    background: rgba(15, 20, 25, 0.5);
    border: 2px solid #2d3748;
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.15s;
    color: #e2e8f0;
    font-family: inherit;
    font-size: 13px;
}

.theme-btn:hover { border-color: #4a90e2; }
.theme-btn.active { border-color: #4a90e2; background: rgba(74, 144, 226, 0.15); }
.theme-preview { width: 100%; height: 60px; border-radius: 8px; margin-bottom: 10px; border: 1px solid #2d3748; }

.link { color: #90cdf4; text-decoration: none; font-weight: 500; }
.link:hover { text-decoration: underline; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.calls-list, #calls-list-full { display: flex; flex-direction: column; gap: 12px; }

.call-card {
    background: rgba(26, 32, 40, 0.75);
    backdrop-filter: blur(8px);
    border: 1px solid #2d3748;
    border-radius: 12px;
    padding: 16px 20px;
    max-width: 100%;
    overflow: hidden;
}

.call-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.call-date { color: #a0aec0; font-size: 13px; }
.call-duration { color: #718096; font-size: 13px; }

.call-status {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-completed { background: rgba(72, 187, 120, 0.15); color: #9ae6b4; }
.status-in_progress { background: rgba(74, 144, 226, 0.15); color: #90cdf4; }
.status-scheduled { background: rgba(160, 174, 192, 0.15); color: #a0aec0; }
.status-failed, .status-error { background: rgba(252, 129, 129, 0.15); color: #fc8181; }

.call-recording audio {
    background: rgba(15, 20, 25, 0.7);
    border-radius: 8px;
    height: 40px;
    width: 100%;
}

.transcript {
    background: rgba(15, 20, 25, 0.5);
    border-radius: 8px;
    padding: 12px 16px;
    max-height: 400px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.6;
    word-break: break-word;
}

.call-card details summary { user-select: none; cursor: pointer; }
.call-card details summary:hover { text-decoration: underline; }

@media (max-width: 900px) {
    .detail-grid, .info-grid, .edit-grid { grid-template-columns: 1fr; }
    .roles-info { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: 260px; box-shadow: 4px 0 20px rgba(0,0,0,0.5); }
    .sidebar.open { transform: translateX(0); }

    .main {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
        padding: 80px 16px 32px;
    }

    .hamburger { display: block; }
    .page-title { font-size: 22px; margin-bottom: 16px; }
    .page-header { flex-direction: column; align-items: stretch; gap: 12px; }
    .page-header .btn { width: 100%; padding: 12px; font-size: 15px; }
    .cards { grid-template-columns: 1fr; gap: 12px; }
    .card { padding: 18px; }
    .card-value { font-size: 24px; }
    .clock-time { font-size: 36px; }
    .btn { padding: 12px 16px; font-size: 15px; }
    .modal { padding: 20px; width: 100%; }
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions .btn { width: 100%; }
    .login-box { padding: 32px 20px; }
    .login-logo { font-size: 32px; }
    .login-box input { padding: 14px; font-size: 16px; }
    .theme-buttons { grid-template-columns: 1fr; }
    .drop-zone { padding: 40px 16px; }
    .table { min-width: 700px; }
    .table th, .table td { padding: 10px 12px; font-size: 13px; }
    .chart-block { padding: 16px; max-width: 100%; }
    .section-header { flex-direction: column; align-items: stretch; }
}

@media (max-width: 380px) {
    .clock-time { font-size: 28px; }
    .page-title { font-size: 20px; }
    .card-value { font-size: 22px; }
}