/* SYSTEM RESET & BASE STYLES */
:root {
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #1e1b4b;
    --glass-bg: rgba(30, 41, 59, 0.45);
    --glass-bg-hover: rgba(30, 41, 59, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-focus: rgba(56, 189, 248, 0.4);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --color-primary: #38bdf8; /* Xanh trời nhạt */
    --color-primary-hover: #0ea5e9;
    --color-success: #34d399; /* Xanh ngọc lục bảo */
    --color-warning: #fbbf24; /* Vàng hổ phách */
    --color-danger: #f87171; /* Đỏ cam dịu */
    
    --shadow-sm: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.15), 0 8px 10px -6px rgb(0 0 0 / 0.15);
    --shadow-glow-red: 0 0 20px rgba(248, 113, 113, 0.25);
    --shadow-glow-blue: 0 0 20px rgba(56, 189, 248, 0.25);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-gradient-start);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* NỀN ĐỘNG GRADIENT */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 10% 20%, rgba(30, 27, 75, 1) 0%, rgba(15, 23, 42, 1) 90%);
    z-index: -2;
}

.bg-gradient::after {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0) 70%);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
}

/* CONTAINER CHÍNH */
.app-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* HEADER CẤU TRÚC KÍNH MỜ (GLASSMORPHISM) */
.glass-header {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
    transition: all 0.3s ease;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    font-size: 2.2rem;
    color: var(--color-primary);
    filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.4));
}

.logo-section h1 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #ffffff 0%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-section p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* TABS ĐIỀU HƯỚNG */
.nav-tabs {
    display: flex;
    background: rgba(15, 23, 42, 0.4);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease-in-out;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: var(--bg-gradient-start);
    background: var(--color-primary);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.35);
}

.spinner-pulse {
    animation: fa-spin 2s infinite linear;
}

/* PHẦN ĐĂNG NHẬP / THÔNG TIN BẢO MẬT */
.auth-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.badge-role {
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-role.guest {
    background: rgba(248, 113, 113, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.badge-role.admin {
    background: rgba(52, 211, 153, 0.15);
    color: var(--color-success);
    border: 1px solid rgba(52, 211, 153, 0.2);
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.1);
}

/* NÚT BẤM (BUTTONS) */
.btn {
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    color: var(--bg-gradient-start);
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.3);
}

.btn-primary:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.45);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.btn-danger {
    background: rgba(248, 113, 113, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.btn-danger:hover {
    background: var(--color-danger);
    color: var(--bg-gradient-start);
    transform: translateY(-2px);
}

/* NỘI DUNG CHÍNH */
.main-content {
    min-height: 500px;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.tab-pane.active {
    display: block;
}

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

.action-bar h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    position: relative;
    padding-left: 14px;
}

.action-bar h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15%;
    height: 70%;
    width: 4px;
    background-color: var(--color-primary);
    border-radius: 4px;
}

/* DANH SÁCH THẺ HỢP ĐỒNG (GRID & CARDS) */
.contracts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 20px;
}

/* STYLE THẺ HỢP ĐỒNG CAO CẤP */
.contract-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Hiệu ứng Hover thẻ */
.contract-card:hover {
    transform: translateY(-5px);
    background: var(--glass-bg-hover);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-lg);
}

/* Cảnh báo trễ hạn */
.contract-card.overdue-glow {
    border-color: rgba(248, 113, 113, 0.4);
    box-shadow: 0 0 15px rgba(248, 113, 113, 0.12);
}

.contract-card.overdue-glow:hover {
    border-color: rgba(248, 113, 113, 0.7);
    box-shadow: var(--shadow-glow-red);
}

/* Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.code-badge {
    background: rgba(56, 189, 248, 0.15);
    color: var(--color-primary);
    border: 1px solid rgba(56, 189, 248, 0.25);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.checkbox-complete-wrapper {
    display: flex;
    align-items: center;
}

.complete-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    outline: none;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
}

.complete-checkbox:checked {
    background-color: var(--color-success);
    border-color: var(--color-success);
}

.complete-checkbox:checked::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--bg-gradient-start);
    font-size: 0.8rem;
}

.complete-checkbox:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.complete-checkbox:not(:disabled):hover {
    border-color: var(--color-success);
    transform: scale(1.08);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.delete-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: var(--color-danger);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.delete-btn:hover:not(:disabled) {
    background: var(--color-danger);
    color: var(--bg-gradient-start);
    transform: scale(1.05);
}

.delete-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.revert-btn {
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.2);
    color: var(--color-primary);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.revert-btn:hover:not(:disabled) {
    background: var(--color-primary);
    color: var(--bg-gradient-start);
    transform: scale(1.03);
}

.revert-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Card Body */
.card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.partner-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.value-highlight {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-warning);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
}

.value-highlight i {
    font-size: 1rem;
    color: var(--text-muted);
}

.date-timeline {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(15, 23, 42, 0.3);
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.85rem;
}

.date-box {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.date-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.date-val {
    font-weight: 500;
    color: var(--text-primary);
}

.date-arrow {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 30px;
}

.status-badge.processing {
    background: rgba(56, 189, 248, 0.1);
    color: var(--color-primary);
}

.status-badge.completed {
    background: rgba(52, 211, 153, 0.1);
    color: var(--color-success);
}

.status-badge.overdue {
    background: rgba(248, 113, 113, 0.1);
    color: var(--color-danger);
    animation: pulseGlow 2s infinite alternate;
}

/* Card Footer (Ghi chú tiến độ) */
.card-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notes-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notes-content {
    background: rgba(15, 23, 42, 0.2);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.88rem;
    color: var(--text-primary);
    min-height: 60px;
    max-height: 120px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.02);
    word-break: break-word;
    font-style: italic;
}

.notes-content.empty {
    color: var(--text-muted);
}

.edit-notes-trigger {
    background: none;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}

.edit-notes-trigger:hover:not(:disabled) {
    background: rgba(56, 189, 248, 0.15);
    color: #fff;
}

.edit-notes-trigger:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* MODALS LAYOUT */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

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

.modal-content {
    width: 100%;
    max-width: 700px;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--shadow-lg), 0 0 30px rgba(0, 0, 0, 0.3);
    animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

.modal-content.small-modal {
    max-width: 450px;
}

.modal-header {
    background: rgba(15, 23, 42, 0.3);
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 i {
    color: var(--color-primary);
}

.close-modal-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.6rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    flex: 1;
}

.modal-hint {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.modal-footer {
    background: rgba(15, 23, 42, 0.3);
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* FORMS ELEMENTS */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.required {
    color: var(--color-danger);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--glass-border);
    color: #fff;
    padding: 12px 14px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    width: 100%;
    transition: all 0.2s ease;
}

input:focus,
textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
}

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

.passcode-input-wrapper input {
    padding-right: 46px;
}

#toggle-pwd-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
}

#toggle-pwd-btn:hover {
    color: var(--text-primary);
}

.form-help-text {
    font-size: 0.8rem;
    color: var(--color-warning);
    font-weight: 500;
    margin-top: 2px;
}

.error-text {
    color: var(--color-danger);
    font-size: 0.82rem;
    font-weight: 500;
    min-height: 16px;
}

.contract-info-brief {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 10px;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    font-size: 0.88rem;
}

/* TAB THỐNG KÊ (KPI CARDS & CHARTS) */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-3px);
    background: var(--glass-bg-hover);
    box-shadow: var(--shadow-md);
}

.kpi-card.warning-glow {
    border-color: rgba(248, 113, 113, 0.2);
}

.kpi-card.warning-glow:hover {
    box-shadow: var(--shadow-glow-red);
    border-color: rgba(248, 113, 113, 0.4);
}

.kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
}

.kpi-icon.color-blue {
    background: rgba(56, 189, 248, 0.15);
    color: var(--color-primary);
}

.kpi-icon.color-gold {
    background: rgba(251, 191, 36, 0.15);
    color: var(--color-warning);
}

.kpi-icon.color-green {
    background: rgba(52, 211, 153, 0.15);
    color: var(--color-success);
}

.kpi-icon.color-red {
    background: rgba(248, 113, 113, 0.15);
    color: var(--color-danger);
}

.kpi-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.kpi-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.kpi-subtext {
    font-size: 0.75rem;
    color: var(--color-danger);
    font-weight: 600;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
}

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

.chart-container {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: var(--shadow-sm);
}

.chart-container h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-wrapper {
    position: relative;
    width: 100%;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ĐANG TẢI & TRỐNG */
.loading-spinner {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 60px 0;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.loading-spinner i {
    font-size: 2rem;
    color: var(--color-primary);
}

.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 80px 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    color: var(--text-secondary);
    text-align: center;
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-muted);
}

.empty-state h4 {
    font-size: 1.2rem;
    color: var(--text-primary);
    font-weight: 600;
}

.empty-state p {
    font-size: 0.9rem;
    max-width: 400px;
}

/* ANIMATIONS */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulseGlow {
    from { box-shadow: 0 0 5px rgba(248, 113, 113, 0.1); }
    to { box-shadow: 0 0 15px rgba(248, 113, 113, 0.35); }
}

/* RESPONSIVE DESIGN */
@media (max-width: 992px) {
    .glass-header {
        flex-direction: column;
        gap: 20px;
        align-items: stretch;
        padding: 20px;
    }
    
    .nav-tabs {
        justify-content: center;
    }
    
    .auth-section {
        justify-content: space-between;
    }
}

@media (max-width: 600px) {
    .nav-tabs {
        flex-direction: column;
        width: 100%;
    }
    
    .tab-btn {
        width: 100%;
        justify-content: center;
    }
    
    .contracts-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}

/* FOOTER TÁC GIẢ */
.app-footer {
    margin-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 18px 0 10px;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.footer-copy {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-author {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.footer-dev-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-dev-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.footer-link {
    font-size: 0.82rem;
    color: #818cf8;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    transition: all 0.2s;
}

.footer-link:hover {
    background: rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
}

.footer-sep {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.footer-zalo {
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

@media (max-width: 640px) {
    .footer-inner {
        flex-direction: column;
    }
}

/* AI UPLOAD & INSTALLMENTS STYLES */
.ai-upload-group {
    background: rgba(56, 189, 248, 0.05);
    padding: 15px;
    border-radius: 10px;
    border: 1px dashed rgba(56, 189, 248, 0.3);
}

.file-input-wrapper {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.file-input-wrapper input[type="file"] {
    flex: 1;
    padding: 8px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    border-radius: 8px;
}

.executing-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.9rem;
}

.executing-table th {
    text-align: left;
    padding: 10px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.executing-table td {
    padding: 12px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.btn-small {
    padding: 4px 10px;
    font-size: 0.8rem;
}

/* CHECKLIST TIẾN ĐỘ CÔNG VIỆC */
.task-card-item {
    transition: all 0.2s ease-in-out;
}

.task-card-item.completed {
    opacity: 0.6;
}

.task-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

/* 6 màu cho 6 trạng thái thực tế */
.task-badge.status-1 {
    background: rgba(56, 189, 248, 0.15); /* Muted blue */
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.task-badge.status-2 {
    background: rgba(168, 85, 247, 0.15); /* Purple */
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.task-badge.status-3 {
    background: rgba(245, 158, 11, 0.15); /* Orange/Gold */
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.task-badge.status-4 {
    background: rgba(20, 184, 166, 0.15); /* Teal/Cyan */
    color: #2dd4bf;
    border: 1px solid rgba(20, 184, 166, 0.3);
}

.task-badge.status-5 {
    background: rgba(236, 72, 153, 0.15); /* Pink */
    color: #f472b6;
    border: 1px solid rgba(236, 72, 153, 0.3);
}

.task-badge.status-6 {
    background: rgba(239, 68, 68, 0.15); /* Red/Coral */
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.task-date.overdue-text {
    color: var(--color-danger) !important;
    text-shadow: 0 0 8px rgba(248, 113, 113, 0.3);
}

/* ================== TAB SOẠN THẢO AI ================== */
.ai-writer-container {
    display: flex;
    gap: 20px;
    height: calc(100vh - 200px);
    min-height: 550px;
    width: 100%;
}

.ai-chat-column {
    flex: 2;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.ai-editor-column {
    flex: 3;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.chat-header, .editor-header {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.15);
}

.chat-header h3, .editor-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.chat-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(15, 23, 42, 0.2);
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.45;
}

.message.system {
    align-self: center;
    background: rgba(56, 189, 248, 0.08);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.15);
    max-width: 90%;
    text-align: center;
}

.message.user {
    align-self: flex-end;
    background: var(--color-primary);
    color: #0f172a;
    font-weight: 500;
    border-bottom-right-radius: 2px;
}

.message.assistant {
    align-self: flex-start;
    background: rgba(30, 41, 59, 0.7);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom-left-radius: 2px;
}

.chat-input-wrapper {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 10px;
    background: rgba(15, 23, 42, 0.3);
}

.chat-input-wrapper textarea {
    flex: 1;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 14px;
    color: #fff;
    resize: none;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.5;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 42px;
    max-height: 195px; /* Chiều cao tối đa cho ~8 dòng chữ */
    height: 42px;
    box-sizing: border-box;
    overflow-y: auto;
}

.chat-input-wrapper textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
}

.editor-paper-wrapper {
    flex: 1;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.4);
    padding: 25px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.paper-editor {
    background: #ffffff;
    color: #1e293b;
    width: 100%;
    max-width: 800px;
    min-height: 100%;
    box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    padding: 40px 50px;
    font-family: 'Times New Roman', Times, serif;
    font-size: 1.05rem;
    line-height: 1.6;
    outline: none;
    white-space: pre-wrap;
    text-align: left;
    overflow-y: visible;
}

.paper-editor p {
    margin: 0;
    min-height: 1em;
}

.paper-editor:empty::before {
    content: attr(placeholder);
    color: #94a3b8;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-style: italic;
}

.typing-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border-bottom-left-radius: 2px;
    align-self: flex-start;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

@media (max-width: 1024px) {
    .ai-writer-container {
        flex-direction: column;
        height: auto;
    }
    .ai-chat-column, .ai-editor-column {
        height: 600px;
    }
}

.btn-action-edit {
    color: #38bdf8;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    margin-right: 15px;
    transition: transform 0.2s, color 0.2s;
    padding: 4px;
}
.btn-action-delete {
    color: #f87171;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.2s, color 0.2s;
    padding: 4px;
}
.btn-action-edit:hover {
    transform: scale(1.2);
    color: #0ea5e9;
}
.btn-action-delete:hover {
    transform: scale(1.2);
    color: #ef4444;
}
