:root {
    --ui-zoom: 0.75;
    --primary: #5271FF;
    --primary-hover: #405ce6;
    --primary-light: rgba(82, 113, 255, 0.1);
    --accent: #820933;
    --danger-color: #820933;
    --text-main: #0f0e0d;
    --text-muted: #6b7280;
    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Scale entire UI to 75% — equivalent to browser zoom at 75% */
html {
    zoom: var(--ui-zoom);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
    min-height: calc(100vh / var(--ui-zoom));
}

/* App Layout */
.app-container {
    display: flex;
    height: calc(100vh / var(--ui-zoom));
    min-height: calc(100vh / var(--ui-zoom));
}

/* Sidebar */
.sidebar {
    width: 250px;
    height: calc(100vh / var(--ui-zoom));
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: width var(--transition-base);
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar-header {
    height: 72px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    transition: padding var(--transition-base), justify-content var(--transition-base);
}

.sidebar.collapsed .sidebar-header {
    justify-content: center !important;
    padding: 0;
}

.brand-logo {
    height: 32px;
    max-width: 100%;
}

.sidebar.collapsed .brand-logo {
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    padding: 12px 16px 4px 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: opacity var(--transition-base);
}

.sidebar.collapsed .sidebar-section-title {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    font-weight: 500;
    white-space: nowrap;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .nav-text {
    display: none;
}

.nav-item:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

.nav-item.active {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav-item i,
.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.top-header {
    height: 72px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
}

.page-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.notifications-wrapper {
    position: relative;
}

.notifications-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-main);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all var(--transition-fast);
}

.notifications-btn:hover,
.notifications-btn.open {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.notifications-btn i,
.notifications-btn svg {
    width: 18px;
    height: 18px;
}

.notifications-count {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: #fff;
    border: 2px solid var(--bg-surface);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    padding: 0 4px;
}

.notifications-panel {
    position: absolute;
    top: 48px;
    right: 0;
    width: 390px;
    max-width: min(88vw, 390px);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-hover);
    padding: 8px;
    display: none;
    z-index: 35;
}

.notifications-panel.show {
    display: block;
}

.notifications-header {
    padding: 8px 10px 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 6px;
}

.notifications-header h4 {
    font-size: 14px;
    margin-bottom: 2px;
}

.notifications-subtitle {
    color: var(--text-muted);
    font-size: 11px;
}

.notification-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.notification-item:hover {
    background: #f8fafc;
}

.notification-item i,
.notification-item svg {
    width: 15px;
    height: 15px;
    color: var(--primary);
    margin-top: 2px;
    flex-shrink: 0;
}

.notification-item.urgency-high {
    background: #fffbeb;
}

.notification-item.urgency-high i,
.notification-item.urgency-high svg {
    color: #b45309;
}

.notification-item p {
    font-size: 12px;
    color: var(--text-main);
    margin: 0;
}

.notification-item span {
    font-size: 11px;
    color: var(--text-muted);
}

.ai-assistant-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    color: var(--text-main);
    border-radius: var(--radius-full);
    padding: 7px 14px 7px 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.ai-assistant-trigger:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.ai-assistant-trigger-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ai-assistant-trigger-icon i,
.ai-assistant-trigger-icon svg {
    width: 15px;
    height: 15px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    transition: background var(--transition-fast);
}

.user-profile:hover {
    background-color: var(--bg-main);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    box-shadow: var(--shadow-sm);
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--text-muted);
}

/* View Container */
.view-container {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    position: relative;
    background-color: var(--bg-main);
}

.ai-assistant-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 14, 13, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
    z-index: 120;
}

.ai-assistant-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.ai-assistant-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 460px;
    max-width: min(92vw, 460px);
    height: calc(100vh / var(--ui-zoom));
    background-color: #f6f8ff;
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 24px rgba(15, 14, 13, 0.16);
    transform: translateX(100%);
    transition: transform var(--transition-base);
    z-index: 130;
    display: flex;
    flex-direction: column;
}

.ai-assistant-panel.show {
    transform: translateX(0);
}

.ai-assistant-panel-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.ai-assistant-panel-header h3 {
    font-size: 17px;
    margin-bottom: 3px;
}

.ai-assistant-panel-header p {
    color: var(--text-muted);
    font-size: 12px;
}

.ai-assistant-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 10px;
}

.ai-assistant-messages.empty-state-visible {
    justify-content: center;
}

.ai-assistant-empty-state {
    border: 1px dashed #c7d2fe;
    background: #eef2ff;
    color: #334155;
    border-radius: var(--radius-md);
    padding: 18px 16px;
    font-size: 13px;
    max-width: 340px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

.ai-assistant-empty-state h4 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
}

.ai-assistant-empty-state p {
    margin: 0;
    line-height: 1.5;
    color: #475569;
}

.ai-message {
    max-width: 85%;
    border-radius: 14px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.45;
    white-space: pre-wrap;
}

.ai-message.user {
    align-self: flex-end;
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 6px;
}

.ai-message.assistant {
    align-self: flex-start;
    background: #ffffff;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 6px;
}

.ai-message-mode {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-weight: 700;
    opacity: 0.75;
    margin-bottom: 4px;
}

.thinking-dots span {
    animation: thinkingBlink 1.2s infinite;
    opacity: 0.25;
}

.thinking-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes thinkingBlink {
    0%, 100% {
        opacity: 0.25;
    }

    50% {
        opacity: 1;
    }
}

.ai-assistant-composer {
    border-top: 1px solid var(--border-color);
    background: #ffffff;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-assistant-mode-switch {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.ai-mode-btn {
    border: 1px solid var(--border-color);
    background: #fff;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    padding: 7px 10px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.ai-mode-btn.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.ai-assistant-attachments {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-assistant-attach-btn {
    width: fit-content;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 12px;
}

.ai-assistant-file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ai-assistant-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #3730a3;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
}

#ai-assistant-input {
    width: 100%;
    min-height: 76px;
    resize: vertical;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 11px 12px;
    outline: none;
    font-size: 13px;
    line-height: 1.4;
    transition: all var(--transition-fast);
}

#ai-assistant-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.view {
    display: none;
    animation: fadeIn var(--transition-base);
}

.view.active-view {
    display: block;
}

/* AI Tools Portfolio */
.ai-tools-view-header {
    justify-content: flex-start;
    margin-bottom: 24px;
}

.ai-tools-view-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-main);
}

.ai-tools-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.ai-tool-card {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    align-items: center;
    gap: 26px;
    padding: 28px 30px;
    border-radius: 28px;
    border: 1px solid #e8efff;
    background: linear-gradient(130deg, #f5f9ff 0%, #faf8ff 100%);
    box-shadow: 0 10px 20px rgba(31, 41, 55, 0.04);
    min-height: 220px;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.ai-tool-card:hover {
    transform: translateY(-2px);
    border-color: #d6e3ff;
    box-shadow: 0 14px 28px rgba(82, 113, 255, 0.14);
}

.ai-tool-icon-shell {
    width: 170px;
    height: 170px;
    border-radius: 24px;
    background: linear-gradient(135deg, #5675ff 0%, #4565f0 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ai-tool-icon-shell::after {
    content: "";
    position: absolute;
    right: -38px;
    bottom: -52px;
    width: 126px;
    height: 126px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.14);
    transform: rotate(45deg);
}

.ai-tool-icon-shell img {
    width: 112px;
    height: 112px;
    object-fit: contain;
    z-index: 1;
    display: block;
}

.ai-tool-content {
    min-width: 0;
}

.ai-tool-title {
    font-size: 1.4rem;
    line-height: 1.2;
    letter-spacing: 0;
    margin-bottom: 12px;
    color: #0f172a;
}

.ai-tool-description {
    font-size: clamp(1.3rem, 1.4vw, 2.05rem);
    line-height: 1.42;
    color: #64748b;
    max-width: 22ch;
}

@media (max-width: 1500px) {
    .ai-tool-card {
        grid-template-columns: 152px minmax(0, 1fr);
        min-height: 196px;
        padding: 24px 24px;
        gap: 20px;
    }

    .ai-tool-icon-shell {
        width: 146px;
        height: 146px;
        border-radius: 20px;
    }

    .ai-tool-icon-shell img {
        width: 94px;
        height: 94px;
    }
}

@media (max-width: 1180px) {
    .ai-tools-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .ai-tool-card {
        grid-template-columns: 1fr;
        align-items: flex-start;
        min-height: 0;
    }

    .ai-tool-icon-shell {
        width: 120px;
        height: 120px;
    }

    .ai-tool-icon-shell img {
        width: 78px;
        height: 78px;
    }

    .ai-tool-title,
    .ai-tool-description {
        max-width: none;
    }
}

/* Actions Bar */
.actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.search-box {
    position: relative;
    width: 350px;
}

.search-box i,
.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    font-size: 14px;
    outline: none;
    transition: all var(--transition-fast);
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.btn i,
.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 2px 4px rgba(82, 113, 255, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 8px rgba(82, 113, 255, 0.3);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-main);
    border-color: #cbd5e1;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    color: var(--text-main);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background-color: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* Table */
.table-container {
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th {
    background-color: #f1f5f9;
    padding: 16px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    transition: background-color var(--transition-fast);
}

.data-table tbody tr {
    transition: all var(--transition-fast);
}

.data-table tbody tr:hover {
    background-color: var(--primary-light);
    cursor: pointer;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    box-shadow: var(--shadow-sm);
}

.user-cell-meta {
    display: flex;
    flex-direction: column;
}

.user-cell-name {
    font-weight: 600;
    color: var(--text-main);
}

.badge-access {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.badge-access-admin {
    background: rgba(82, 113, 255, 0.14);
    color: #3650ca;
}

.badge-access-it {
    background: rgba(130, 9, 51, 0.14);
    color: #820933;
}

.badge-access-expert {
    background: rgba(14, 165, 233, 0.15);
    color: #0369a1;
}

.badge-access-reader {
    background: #e2e8f0;
    color: #475569;
}

.btn-edit-role {
    padding: 8px 12px;
    font-size: 12px;
}

.btn-edit-role i,
.btn-edit-role svg {
    width: 14px;
    height: 14px;
}

.permission-matrix-table th,
.permission-matrix-table td {
    text-align: center;
}

.permission-matrix-table th:first-child,
.permission-matrix-table td:first-child {
    text-align: left;
    min-width: 320px;
}

.permission-label-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.permission-label-cell i,
.permission-label-cell svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.permission-label-cell.permission-child {
    padding-left: 24px;
    font-weight: 500;
}

.permission-checkbox,
.role-user-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.role-users-table th:last-child,
.role-users-table td:last-child {
    width: 120px;
    text-align: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    min-height: 22px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    background-color: #e2e8f0;
    color: #475569;
}

.badge-success {
    background-color: #dcfce7;
    color: #166534;
}

.badge-warning {
    background-color: #fef9c3;
    color: #854d0e;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background-color: #e0f2fe;
    color: #075985;
}

.truncate-1line {
    display: block;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.procedures-table-container {
    overflow-x: auto;
}

.procedures-data-table {
    min-width: 1580px;
    width: max-content;
}

.procedures-data-table th,
.procedures-data-table td {
    white-space: nowrap;
    vertical-align: middle;
}

/* Form Styles */
.form-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.form-header h2 {
    font-size: 24px;
    font-weight: 700;
}

.procedure-header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.procedure-status-wrapper {
    min-width: 210px;
}

.form-card {
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    max-width: 900px;
    margin: 0 auto;
}

.grid-layout {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.full-width {
    grid-column: span 2;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i,
.input-wrapper svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.input-wrapper input,
.input-wrapper select {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    font-size: 14px;
    color: var(--text-main);
    outline: none;
    transition: all var(--transition-fast);
    -webkit-appearance: none;
    appearance: none;
}

.input-wrapper select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.input-wrapper select[multiple] {
    background-image: none;
    padding-right: 16px;
    min-height: 120px;
}

.input-wrapper select[multiple] option {
    padding: 6px 8px;
}

.input-wrapper input:focus,
.input-wrapper select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background-color: var(--bg-surface);
}

.input-wrapper input:focus+i,
.input-wrapper select:focus+i,
.input-wrapper input:focus+svg,
.input-wrapper select:focus+svg {
    color: var(--primary);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 16px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn var(--transition-base);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp var(--transition-base);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: #10b981;
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-md);
    transform: translateY(150%);
    opacity: 0;
    transition: all var(--transition-base);
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-icon {
    width: 20px;
    height: 20px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 14, 13, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal-card {
    width: 100%;
    max-width: 520px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-hover);
    animation: fadeInUp 180ms ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.2rem;
}

.modal-close-btn {
    width: 32px;
    height: 32px;
}

.modal-body {
    padding: 20px 24px;
}

.modal-subtitle {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--border-color);
    padding: 16px 24px 20px 24px;
}

/* Responsive */
@media (max-width: 1024px) {
    .grid-layout {
        grid-template-columns: 1fr;
    }

    .full-width {
        grid-column: span 1;
    }

    .sidebar {
        width: 80px;
    }

    .nav-item span {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 12px;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        height: auto;
    }

    .sidebar {
        width: 100%;
        flex-direction: column;
        height: auto;
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 12px 16px;
    }

    .nav-item span {
        display: block;
    }

    .table-container {
        overflow-x: auto;
    }

    .modal-card {
        max-width: 100%;
    }

    .actions-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .header-right {
        gap: 12px;
    }

    .notifications-panel {
        right: -76px;
    }

    .ai-assistant-trigger span:not(.ai-assistant-trigger-icon) {
        display: none;
    }

    .ai-assistant-trigger {
        padding-right: 10px;
    }

    .ai-assistant-panel {
        width: 100%;
        max-width: 100%;
    }
}

/* Dashboard Layout */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

.kpi-tile {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: var(--transition-fast);
}

.kpi-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kpi-title-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kpi-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

.kpi-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.kpi-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-icon {
    width: 20px;
    height: 20px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
}

.kpi-deadlines-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kpi-deadline-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--border-color);
}

.kpi-deadline-item:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.kpi-deadline-product,
.kpi-deadline-date {
    font-size: 12px;
    line-height: 1.2;
}

.kpi-deadline-product {
    font-weight: 600;
    color: var(--text-main);
    max-width: 58%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-deadline-date {
    color: var(--text-muted);
    white-space: nowrap;
}

@media (max-width: 1024px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .team-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .team-kpi-grid {
        grid-template-columns: 1fr;
    }

    .procedure-effort-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
}

.dashboard-layout {
    display: grid;
    grid-template-columns: 1fr minmax(280px, 30%);
    gap: 24px;
    height: 100%;
    align-items: stretch;
}

.dashboard-left-stack {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 0;
}

.recent-files-panel {
    min-height: 260px;
}

@media (max-width: 1024px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .team-dashboard-layout {
        grid-template-columns: 1fr;
    }

    .team-trends-grid {
        grid-template-columns: 1fr;
    }
}

.dashboard-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

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

.team-kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-sm);
}

.team-kpi-card.team-kpi-launches {
    background: linear-gradient(135deg, #fff7e6 0%, #ffe8cb 100%);
    border-color: #ffd8a8;
}

.team-kpi-title {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.team-kpi-value {
    font-size: 28px;
    line-height: 1;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--text-main);
}

.team-kpi-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.team-dashboard-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.team-main-col,
.team-side-col {
    display: flex;
    flex-direction: column;
}

.team-side-panel {
    height: 100%;
}

.capacity-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.capacity-inline-bar {
    width: 120px;
    height: 8px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.capacity-inline-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #5271FF, #0EA5E9);
}

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

.procedure-effort-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.procedure-effort-slider-wrap {
    min-width: 260px;
}

.procedure-effort-slider-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.procedure-effort-range {
    width: 100%;
    accent-color: var(--primary);
}

.procedure-effort-slider-steps {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.procedure-effort-slider-steps span.active {
    color: var(--primary);
}

.procedure-effort-total {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
}

.procedure-effort-chart {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.procedure-effort-month {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px;
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.procedure-effort-month-header {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: baseline;
    margin-bottom: 8px;
}

.procedure-effort-month-label {
    font-size: 12px;
    font-weight: 700;
}

.procedure-effort-month-total {
    font-size: 11px;
    color: var(--text-muted);
}

.procedure-effort-stack {
    margin-top: auto;
    height: 136px;
    border-radius: 10px;
    background: #eef2ff;
    border: 1px solid #dbe4ff;
    display: flex;
    flex-direction: column-reverse;
    overflow: hidden;
}

.procedure-effort-segment {
    min-height: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.5);
    padding: 3px 6px;
    font-size: 10px;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.procedure-effort-empty {
    margin-top: auto;
    height: 136px;
    border-radius: 10px;
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    background: #f8fafc;
}

.procedure-effort-legend {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 8px;
}

.procedure-effort-legend-item {
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.procedure-effort-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    flex-shrink: 0;
}

.user-resource-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.user-resource-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    padding: 12px;
}

.user-resource-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.user-resource-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
}

.user-resource-total {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.user-resource-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid transparent;
    text-transform: capitalize;
}

.user-resource-status.overloaded {
    background: #fff1f2;
    color: #b42318;
    border-color: #fecdd3;
}

.user-resource-status.balanced {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.user-resource-status.available {
    background: #ecfdf3;
    color: #027a48;
    border-color: #abefc6;
}

.user-resource-track {
    width: 100%;
    height: 14px;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid #dbe4ff;
    background: #eef2ff;
    display: flex;
}

.user-resource-segment {
    height: 100%;
    min-width: 4px;
    border-right: 1px solid rgba(255, 255, 255, 0.6);
}

.user-resource-splits {
    margin-top: 8px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 6px;
}

.user-resource-split {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-resource-split-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    flex-shrink: 0;
}

.user-resource-empty {
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px;
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
}

.risk-overview-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.risk-overview-card {
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.risk-overview-card span {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.risk-overview-card strong {
    font-size: 22px;
    color: var(--text-main);
    line-height: 1;
}

.risk-overview-statuses {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.risk-flag {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 10px;
    width: fit-content;
    border: 1px solid transparent;
}

.risk-flag-red {
    background: #fff1f2;
    color: #b42318;
    border-color: #fecdd3;
}

.risk-flag-amber {
    background: #fffbeb;
    color: #b54708;
    border-color: #fcd34d;
}

.risk-status-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border: 1px solid transparent;
    text-transform: capitalize;
}

.risk-status-badge.overdue {
    background: #fff1f2;
    color: #b42318;
    border-color: #fecdd3;
}

.risk-status-badge.approaching {
    background: #fffbeb;
    color: #b54708;
    border-color: #fcd34d;
}

.risk-task-cell {
    max-width: 360px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.clock-stop-table th,
.clock-stop-table td {
    vertical-align: top;
}

.clock-stop-ticket-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    background: #eef2ff;
    border: 1px solid #dbe4ff;
    border-radius: 999px;
    padding: 3px 8px;
    display: inline-flex;
}

.clock-stop-task-text {
    min-width: 360px;
    max-width: 520px;
    line-height: 1.35;
}

.clock-stop-select {
    width: 170px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 12px;
    background: #fff;
}

.timeline-task.clickable-clockstop {
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(82, 113, 255, 0.15), 0 2px 8px rgba(59, 88, 232, 0.2);
}

@media (max-width: 1024px) {
    .risk-overview-grid {
        grid-template-columns: 1fr;
    }
}

.trend-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px;
    background: var(--bg-main);
}

.trend-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.trend-bars {
    height: 120px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    align-items: end;
}

.trend-bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.trend-bar-col span {
    font-size: 11px;
    color: var(--text-muted);
}

.trend-bar {
    width: 100%;
    border-radius: 6px 6px 3px 3px;
    min-height: 8px;
}

.trend-bar.tasks {
    background: linear-gradient(180deg, #5271FF 0%, #3f5ce0 100%);
}

.trend-bar.procedures {
    background: linear-gradient(180deg, #820933 0%, #5f0725 100%);
}

.capacity-block {
    margin-bottom: 20px;
}

.capacity-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.capacity-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.capacity-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    padding: 10px 12px;
}

.capacity-item-head {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
}

.capacity-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.capacity-track span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #5271FF, #0EA5E9);
}

.team-risk-subtitle {
    color: var(--text-muted);
    font-size: 12px;
    margin: -4px 0 12px;
}

.team-capacity-panel {
    gap: 16px;
}

.team-capacity-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.team-capacity-actions {
    display: inline-flex;
    align-items: flex-start;
    gap: 10px;
    margin-left: auto;
}

.team-capacity-meta {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--bg-main);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
}

.analysis-settings-wrapper {
    position: relative;
}

.analysis-settings-btn {
    width: 34px;
    height: 34px;
}

.analysis-settings-btn i,
.analysis-settings-btn svg {
    width: 16px;
    height: 16px;
}

.analysis-settings-btn.open {
    background-color: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.analysis-settings-menu {
    position: absolute;
    top: 40px;
    right: 0;
    width: 186px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-hover);
    padding: 6px;
    display: none;
    z-index: 30;
}

.analysis-settings-menu.show {
    display: block;
}

.analysis-settings-option {
    width: 100%;
    border: none;
    border-radius: 8px;
    padding: 8px 10px;
    text-align: left;
    background: transparent;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.analysis-settings-option:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.team-capacity-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.team-capacity-kpi-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.team-capacity-kpi-card span {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

.team-capacity-kpi-card strong {
    color: var(--text-main);
    font-size: 18px;
    line-height: 1.25;
}

.team-capacity-chart-shell {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #fcfdff;
    padding: 8px 12px;
    overflow: hidden;
}

.team-capacity-chart {
    width: 100%;
    height: 330px;
    display: block;
}

.team-capacity-grid-line {
    stroke: #e2e8f0;
    stroke-width: 1;
}

.team-capacity-vertical-line {
    stroke: #f1f5f9;
    stroke-width: 1;
}

.team-capacity-grid-label {
    fill: #94a3b8;
    font-size: 11px;
    font-weight: 600;
}

.team-capacity-x-label {
    fill: #64748b;
    font-size: 11px;
    font-weight: 600;
}

.team-capacity-overload-area {
    fill: rgba(130, 9, 51, 0.16);
}

.team-capacity-line {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.team-capacity-line.workload {
    stroke: var(--accent);
}

.team-capacity-line.capacity {
    stroke: var(--primary);
}

.team-capacity-peak-dot {
    fill: var(--accent);
    stroke: #fff;
    stroke-width: 2;
}

.team-capacity-peak-label {
    fill: var(--accent);
    font-size: 11px;
    font-weight: 700;
}

.team-capacity-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

.team-capacity-legend span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.team-capacity-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    display: inline-block;
    flex-shrink: 0;
}

.team-capacity-dot.workload {
    background: var(--accent);
}

.team-capacity-dot.capacity {
    background: var(--primary);
}

.team-capacity-dot.overload {
    background: rgba(130, 9, 51, 0.3);
    border: 1px solid rgba(130, 9, 51, 0.45);
}

.team-budget-section {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    padding: 14px;
}

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

.team-budget-header h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
}

.team-budget-track-badge {
    display: inline-flex;
    align-items: center;
    border-radius: var(--radius-full);
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 700;
    color: #067647;
    background: #ecfdf3;
    border: 1px solid #abefc6;
}

.team-budget-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.team-budget-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    padding: 11px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.team-budget-card span {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.team-budget-card strong {
    font-size: 18px;
    line-height: 1.2;
    color: var(--text-main);
}

.team-deadline-section {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    padding: 14px;
}

.team-deadline-section h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
}

.team-deadline-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.team-deadline-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    padding: 11px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.team-deadline-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.team-deadline-card strong {
    font-size: 18px;
    line-height: 1.2;
    color: var(--text-main);
}

.team-deadline-card p {
    font-size: 12px;
    color: #475569;
    line-height: 1.4;
}

.team-unassigned-tasks {
    margin-top: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    padding: 12px;
}

.team-unassigned-tasks h5 {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 10px;
}

.team-unassigned-task-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.team-unassigned-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    padding: 8px 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.team-unassigned-proc {
    font-weight: 700;
    color: #0f172a;
}

.team-unassigned-task {
    color: #334155;
    flex: 1;
    min-width: 240px;
}

.team-unassigned-date {
    color: #64748b;
    font-weight: 600;
}

.team-unassigned-empty {
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    padding: 10px;
    font-size: 12px;
    color: #475569;
}

.fte-settings-modal-card {
    max-width: 720px;
}

.fte-size-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.fte-size-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fte-size-icon-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fte-size-icon-row i,
.fte-size-icon-row svg {
    width: 22px;
    height: 22px;
    color: var(--primary);
}

.fte-size-tag {
    border-radius: var(--radius-full);
    background: #eef2ff;
    border: 1px solid #dbe4ff;
    color: #3650ca;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.fte-size-card p {
    font-size: 12px;
    color: var(--text-muted);
}

.fte-size-card strong {
    font-size: 16px;
    line-height: 1.2;
    color: var(--text-main);
}

.fte-example-toast {
    margin-top: 12px;
    border: 1px solid #bfdbfe;
    background: #eaf3ff;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.fte-example-toast i,
.fte-example-toast svg {
    width: 16px;
    height: 16px;
    color: #1d4ed8;
    flex-shrink: 0;
    margin-top: 1px;
}

.fte-example-toast p {
    font-size: 12px;
    color: #1e3a8a;
    line-height: 1.45;
}

.fte-example-toast a {
    color: #1d4ed8;
    font-weight: 700;
    text-decoration: underline;
}

@media (max-width: 1200px) {
    .team-capacity-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .team-budget-grid {
        grid-template-columns: 1fr;
    }

    .team-deadline-grid {
        grid-template-columns: 1fr;
    }

    .fte-size-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .team-capacity-kpis {
        grid-template-columns: 1fr;
    }

    .team-capacity-chart {
        height: 300px;
    }

    .team-capacity-actions {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
    }

    .analysis-settings-menu {
        right: auto;
        left: 0;
    }

    .fte-size-grid {
        grid-template-columns: 1fr;
    }
}

.portfolio-risk-matrix {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    height: 320px;
    background: #ffffff;
    overflow: hidden;
}

.portfolio-risk-matrix::before,
.portfolio-risk-matrix::after {
    content: '';
    position: absolute;
    background: #cbd5e1;
    z-index: 2;
}

.portfolio-risk-matrix::before {
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
}

.portfolio-risk-matrix::after {
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
}

.risk-matrix-axis {
    position: absolute;
    z-index: 3;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.risk-matrix-y {
    left: 10px;
    top: 10px;
}

.risk-matrix-x {
    right: 10px;
    bottom: 10px;
}

.risk-matrix-quadrant {
    position: absolute;
    font-size: 11px;
    font-weight: 600;
    color: #334155;
    z-index: 1;
}

.risk-quad-low-low {
    left: 14px;
    bottom: 14px;
}

.risk-quad-high-low {
    right: 14px;
    bottom: 14px;
}

.risk-quad-low-high {
    left: 14px;
    top: 14px;
}

.risk-quad-high-high {
    right: 14px;
    top: 14px;
}

.risk-matrix-points {
    position: absolute;
    inset: 0;
    z-index: 4;
}

.risk-point {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: var(--radius-full);
    background: var(--primary);
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px rgba(15, 14, 13, 0.12);
}

.risk-point.high {
    background: #dc2626;
}

.risk-point.medium {
    background: #d97706;
}

.risk-point.low {
    background: #2563eb;
}

.risk-dot.high {
    background: #dc2626;
}

.risk-dot.medium {
    background: #d97706;
}

.risk-dot.low {
    background: #2563eb;
}

.portfolio-risk-legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.risk-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-main);
    white-space: nowrap;
}

.risk-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    display: inline-block;
}

@media (max-width: 640px) {
    .portfolio-risk-legend {
        grid-template-columns: 1fr;
    }
}

.product-details-layout {
    display: grid;
    grid-template-columns: 7fr 3fr;
    gap: 24px;
    min-height: calc(100vh / var(--ui-zoom) - 220px);
}

.product-details-left {
    display: flex;
    flex-direction: column;
}

.product-details-right {
    display: flex;
}

.product-upload-panel {
    width: 100%;
    height: 100%;
}

#sharepoint-docs-container {
    margin-top: 2px;
}

.sharepoint-tree-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #f8fbff;
    padding: 12px;
}

.sharepoint-tree-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.sharepoint-tree-text {
    margin: 0;
    white-space: pre-wrap;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-main);
}

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

.product-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px;
}

.product-metadata-collapsed .product-meta-grid {
    display: none;
}

.product-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0;
}

.product-meta-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.product-meta-value {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    word-break: break-word;
}

.product-procedures-empty {
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 28px;
    text-align: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.product-procedures-actions {
    margin-top: 14px;
}

.product-procedures-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-procedures-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    cursor: pointer;
    transition: var(--transition-fast);
}

.product-procedures-row:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.product-procedure-number {
    font-family: monospace;
    font-weight: 600;
    color: var(--text-main);
}

.product-subsection-title {
    margin-top: 18px;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.packaging-country-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.packaging-country-tab {
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-main);
    color: var(--text-main);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.packaging-country-tab:hover {
    border-color: var(--primary);
}

.packaging-country-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.hidden {
    display: none !important;
}

.dcp-mrp-country-section {
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    background: #fbfdff;
}

.cms-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cms-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cms-row .input-wrapper {
    flex: 1;
}

.local-representatives-section {
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    background: #fbfdff;
}

.local-representatives-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.local-representatives-empty {
    color: var(--text-muted);
    font-size: 12px;
}

.proc-detail-lock-note {
    min-height: 20px;
    font-size: 12px;
    color: var(--text-muted);
}

.product-api-section {
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    background: #fbfdff;
}

.product-api-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.product-pack-size-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-pack-size-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.product-api-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.dropzone-area {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    background: #f8fbff;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 28px 16px;
    margin-bottom: 14px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dropzone-area:hover,
.dropzone-area.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.dropzone-area i,
.dropzone-area svg {
    width: 28px;
    height: 28px;
}

.dropzone-area p {
    font-weight: 700;
    color: var(--text-main);
}

.dropzone-area span {
    font-size: 12px;
}

@media (max-width: 1024px) {
    .product-details-layout {
        grid-template-columns: 1fr;
    }

    .product-meta-grid {
        grid-template-columns: 1fr;
    }
}

/* Panel Tabs */
.panel-tabs-header {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid var(--border-color);
    margin: 0 -24px 24px -24px;
    padding: 0 24px;
    background: var(--bg-main);
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
}

.panel-tab-btn {
    background: transparent;
    border: none;
    padding: 16px 4px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: var(--transition-fast);
}

.panel-tab-btn:hover {
    color: var(--primary);
}

.panel-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.panel-tab-content {
    display: none;
    flex: 1;
    flex-direction: column;
}

.panel-tab-content.active {
    display: flex;
    animation: fadeIn var(--transition-base);
}

.calendar-source-label {
    display: inline-flex;
    align-items: center;
    margin-bottom: 12px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: #e0e7ff;
    color: #3730a3;
    font-size: 11px;
    font-weight: 600;
}

/* Timeline / Gantt Chart */
.timeline-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 8px;
}

#tab-timeline {
    overflow: hidden;
}

#tab-timeline .timeline-container {
    height: 50vh;
    min-height: 50vh;
}

.timeline-header {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    background: #ffffff;
}

.timeline-procedure-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.timeline-procedure-col span {
    padding: 10px 12px;
    border-right: 1px solid var(--border-color);
}

.timeline-months-row {
    display: grid;
    border-left: 1px solid var(--border-color);
    align-items: end;
}

.timeline-month-cell {
    padding: 10px 8px 8px;
    border-right: 1px solid var(--border-color);
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    text-align: center;
}

.timeline-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: visible;
    padding-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.recent-files-table tbody tr td {
    vertical-align: middle;
}

.recent-file-status-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
}

.recent-file-status-badge.status-draft {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.recent-file-status-badge.status-in-preparation {
    background: #f5f3ff;
    color: #6d28d9;
    border-color: #ddd6fe;
}

.recent-file-status-badge.status-needs-attention {
    background: #fff1f2;
    color: #b42318;
    border-color: #fecdd3;
}

.recent-file-status-badge.status-final {
    background: #ecfdf3;
    color: #027a48;
    border-color: #abefc6;
}

.recent-file-status-badge.status-submitted {
    background: #fffbeb;
    color: #b54708;
    border-color: #fcd34d;
}

.gantt-row {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 0;
    align-items: stretch;
    background: #ffffff;
    border-bottom: 1px solid #eef2f7;
}

.gantt-label {
    display: grid;
    grid-template-columns: 1fr 1fr;
    color: var(--text-main);
    font-size: 0.8rem;
}

.gantt-label-main {
    font-weight: 600;
    padding: 14px 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-right: 1px solid var(--border-color);
}

.gantt-label-sub {
    font-size: 0.78rem;
    color: #0f172a;
    padding: 14px 12px;
    border-right: 1px solid var(--border-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gantt-track-container {
    position: relative;
    min-height: 66px;
    background: #ffffff;
    overflow: hidden;
    border-left: 1px solid var(--border-color);
}

.gantt-grid-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    pointer-events: none;
}

.gantt-grid-lines div {
    border-right: 1px solid #eef2f7;
}

.gantt-lanes {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.gantt-lane-line {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px dashed #eff4fa;
}

.timeline-task {
    position: absolute;
    min-height: 34px;
    background: #ffffff;
    color: var(--text-main);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 6px 10px 6px 11px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    box-shadow: 0 1px 4px rgba(15, 14, 13, 0.1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid #dbe4f0;
    border-left: 4px solid #5271FF;
    cursor: default;
    z-index: 2;
}

.timeline-task-main {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeline-task-label {
    display: block;
    min-width: 0;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-owner-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.75);
    flex-shrink: 0;
}

.timeline-task-avatar {
    margin-left: auto;
}

.timeline-task-sub {
    display: none;
}

.timeline-milestone {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: #3150d4;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(49, 80, 212, 0.35);
    transform: translateX(-50%) rotate(45deg);
    z-index: 3;
    cursor: default;
}

.timeline-milestone-avatar {
    position: absolute;
    z-index: 4;
}

@media (max-width: 1024px) {
    .timeline-header,
    .gantt-row {
        grid-template-columns: 220px 1fr;
    }

    .timeline-procedure-col,
    .gantt-label {
        grid-template-columns: 1fr;
    }

    .gantt-label-main,
    .gantt-label-sub,
    .timeline-procedure-col span {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}

.timeline-hover-tooltip {
    position: fixed;
    z-index: 9999;
    max-width: 280px;
    background: #0f172a;
    color: #f8fafc;
    border-radius: 8px;
    padding: 8px 10px;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.35);
    pointer-events: none;
    opacity: 0;
    transform: translateY(2px);
    transition: opacity 120ms ease, transform 120ms ease;
    font-size: 12px;
    line-height: 1.35;
}

.timeline-hover-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.timeline-hover-title {
    font-weight: 700;
    margin-bottom: 2px;
}

.timeline-hover-owner {
    color: #cbd5e1;
}

/* Markets Container */
.markets-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

.markets-map-shell {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.markets-map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
}

#markets-active-count {
    color: var(--text-muted);
    font-weight: 600;
}

.markets-map-canvas {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    min-height: 380px;
    overflow: hidden;
}

.markets-map-canvas svg {
    width: 100%;
    height: auto;
    display: block;
}

.markets-map-canvas object {
    width: 100%;
    height: 100%;
    min-height: 380px;
    display: block;
    border: 0;
}

.markets-map-canvas .markets-map-image {
    width: 100%;
    height: 100%;
    min-height: 380px;
    display: block;
    object-fit: cover;
}

.markets-map-canvas path {
    transition: fill var(--transition-fast), stroke var(--transition-fast), opacity var(--transition-fast);
}

.markets-map-canvas path.map-country-active-low {
    fill: #bcd1ff !important;
    stroke: #ffffff !important;
}

.markets-map-canvas path.map-country-active-medium {
    fill: #7ea1ff !important;
    stroke: #ffffff !important;
}

.markets-map-canvas path.map-country-active-high {
    fill: var(--primary) !important;
    stroke: #ffffff !important;
}

.markets-map-canvas path.map-country-inactive {
    fill: #dcdcdc !important;
    stroke: #ffffff !important;
}

.markets-map-canvas .map-country-pins {
    pointer-events: none;
}

.markets-map-canvas .markets-pin-ring {
    fill: rgba(82, 113, 255, 0.14);
    stroke: rgba(82, 113, 255, 0.38);
    stroke-width: 1;
}

.markets-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 12px;
    color: var(--text-main);
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.legend-dot-low {
    background: #bcd1ff;
}

.legend-dot-med {
    background: #7ea1ff;
}

.legend-dot-high {
    background: var(--primary);
}

.markets-country-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.markets-country-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 4px 10px;
    border: 1px solid #dbe4f0;
    background: #f8fafc;
    font-size: 11px;
    font-weight: 600;
    color: #334155;
}

.markets-country-chip .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.markets-country-chip .dot.low {
    background: #bcd1ff;
}

.markets-country-chip .dot.medium {
    background: #7ea1ff;
}

.markets-country-chip .dot.high {
    background: var(--primary);
}

/* Calendar Container Adjustments */
.calendar-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 8px;
    flex: 1;
    /* Stretch to take remaining space */
}

.calendar-day {
    aspect-ratio: 1;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 85px;
    min-width: 0;
    transition: var(--transition-fast);
}

.calendar-day.week-view-day {
    aspect-ratio: auto;
    min-height: 150px;
}

.calendar-day:hover:not(.empty-day) {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.calendar-day.empty-day {
    background: transparent;
    border: none;
    pointer-events: none;
}

.calendar-day.today {
    border-color: var(--primary);
    background: var(--primary-light);
}

.day-number {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
    align-self: flex-end;
}

.calendar-day.empty-day .day-number {
    display: none;
}

.task-indicator {
    font-size: 0.70rem;
    font-weight: 500;
    background: var(--primary);
    color: white;
    padding: 4px 6px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    cursor: default;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.task-indicator.urgent {
    background: var(--accent);
}

/* Dashboard Widgets */
.widget-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-main);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.widget-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#urgent-tasks-list {
    height: 430px;
    max-height: 430px;
    overflow-y: auto;
    padding-right: 6px;
}

#urgent-tasks-list .widget-item {
    min-height: 122px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 8px;
}

#urgent-tasks-list .widget-item-title {
    display: block;
    overflow: visible;
    white-space: normal;
    word-break: break-word;
    line-height: 1.35;
    min-height: 2.5em;
    margin-bottom: 2px;
}

#urgent-tasks-list::-webkit-scrollbar {
    width: 8px;
}

#urgent-tasks-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

#urgent-tasks-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 999px;
}

.widget-item-badges {
    display: flex;
    align-items: center;
    gap: 6px;
}

.task-product-badge {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    border-radius: 999px;
    background: #e5e7eb;
    border: 1px solid #d1d5db;
    color: #4b5563;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget-item {
    padding: 14px;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
    transition: var(--transition-fast);
}

.widget-item.urgent {
    border-left-color: var(--accent);
}

.widget-item:hover {
    transform: translateX(2px);
    box-shadow: var(--shadow-sm);
}

.widget-item-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: var(--text-main);
}

.widget-item-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.widget-item-deadline-label {
    font-weight: 600;
    color: #475569;
    margin-right: 2px;
}

#regulatory-news-list {
    gap: 14px;
}

.reg-news-card {
    border: 1px solid #deebff;
    border-radius: 18px;
    background: #ffffff;
    padding: 14px 16px 12px;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.reg-news-card:hover {
    transform: translateY(-1px);
    border-color: #c6dbff;
    box-shadow: 0 8px 20px rgba(82, 113, 255, 0.12);
}

.reg-news-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.reg-news-flag {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    border: 1px solid #d7e2ff;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1;
}

.reg-news-body {
    min-width: 0;
    flex: 1;
}

.reg-news-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.reg-news-title {
    font-size: 1.02rem;
    line-height: 1.28;
    font-weight: 700;
    color: #0f172a;
}

.reg-news-priority {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    padding: 3px 12px;
    font-size: 0.88rem;
    font-weight: 700;
    border: 1px solid;
    flex-shrink: 0;
}

.reg-news-priority-high {
    color: #c2410c;
    background: #fff7ed;
    border-color: #fdba74;
}

.reg-news-priority-medium {
    color: #b45309;
    background: #fffbeb;
    border-color: #fcd34d;
}

.reg-news-priority-low {
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #93c5fd;
}

.reg-news-summary {
    font-size: 0.92rem;
    color: #64748b;
    line-height: 1.4;
    margin-top: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.reg-news-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 11px;
}

.reg-news-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
    background: #f1f7ff;
    border: 1px solid #e2edff;
}

.reg-news-time {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: #64748b;
    white-space: nowrap;
}

.reg-news-time i,
.reg-news-time svg {
    color: #6b7ca7;
}

.reg-news-footer {
    margin-top: 12px;
    padding-top: 11px;
    border-top: 1px solid #eef2ff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.reg-news-impact {
    font-size: 0.95rem;
    color: #516488;
    font-weight: 500;
}

.reg-news-subscription {
    font-size: 0.95rem;
    color: #5b74aa;
    font-weight: 600;
}

@media (max-width: 1280px) {
    .reg-news-title-row {
        flex-direction: column;
        gap: 6px;
    }

    .reg-news-priority {
        align-self: flex-start;
    }
}

/* =============================
   Login Page
   ============================= */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f0e17 0%, #1a1330 40%, #0d1a3a 100%);
    overflow: hidden;
}

/* Subtle animated background orbs */
.login-overlay::before,
.login-overlay::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.25;
    animation: orb-float 8s ease-in-out infinite alternate;
}

.login-overlay::before {
    width: 500px;
    height: 500px;
    background: var(--primary);
    top: -150px;
    left: -150px;
}

.login-overlay::after {
    width: 400px;
    height: 400px;
    background: var(--accent);
    bottom: -100px;
    right: -100px;
    animation-delay: -4s;
}

@keyframes orb-float {
    from {
        transform: translate(0, 0) scale(1);
    }

    to {
        transform: translate(40px, 30px) scale(1.1);
    }
}

.login-card {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 48px 44px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 32px 64px rgba(0, 0, 0, 0.5);
    animation: card-appear 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes card-appear {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
}

.login-brand-logo {
    height: 40px;
    width: auto;
    filter: brightness(0) invert(1);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.login-subtitle {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.55);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-error {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(130, 9, 51, 0.2);
    border: 1px solid rgba(130, 9, 51, 0.4);
    border-radius: 10px;
    padding: 12px 14px;
    color: #fca5a5;
    font-size: 0.875rem;
    animation: shake 0.4s ease;
}

.login-error i {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-6px);
    }

    40% {
        transform: translateX(6px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(4px);
    }
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    letter-spacing: 0.02em;
}

.login-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

/* Login field icons (mail / lock) — class survives Lucide's i→svg swap */
.login-field-icon,
.login-field-icon svg {
    position: absolute;
    left: 14px;
    width: 16px;
    height: 16px;
    color: #9ca3af;
    pointer-events: none;
    margin-right: 12px;
}

.login-input-wrapper input {
    width: 100%;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: #ffffff;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.95rem;
    padding: 13px 44px 13px 46px;
    /* increased left pad: 14px icon + 16px icon + 12px gap + 4px buffer */
    transition: border-color 200ms, background 200ms, box-shadow 200ms;
    outline: none;
}

.login-input-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.login-input-wrapper input:focus {
    border-color: var(--primary);
    background: rgba(82, 113, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(82, 113, 255, 0.2);
}

.login-eye-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: 6px;
    transition: color 150ms;
}

.login-eye-btn:hover {
    color: rgba(255, 255, 255, 0.7);
}

.login-eye-btn i {
    width: 16px;
    height: 16px;
}

.login-btn {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
    justify-content: center;
    border-radius: 12px;
    margin-top: 4px;
    letter-spacing: 0.01em;
    transition: background 200ms, transform 100ms, box-shadow 200ms;
}

.login-btn:active {
    transform: scale(0.98);
}

.login-footer {
    text-align: center;
    margin-top: 28px;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.25);
}

/* Fade-out animation for login overlay on success */
.login-overlay.fade-out {
    animation: overlay-fade-out 0.45s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes overlay-fade-out {
    to {
        opacity: 0;
        pointer-events: none;
    }
}
