/* ===== CSS Variables ===== */
:root {
    --primary: #1E3A5F;
    --accent: #2A9D8F;
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --border: #E5E7EB;
    --text: #1E3A5F;
    --text-meta: #6B7280;
    --danger: #DC2626;
    --warning: #F59E0B;
    --success: #10B981;
    --sidebar-w: 260px;
    --sidebar-bg: #1a2d45;
    --sidebar-hover: rgba(255,255,255,0.08);
    --sidebar-active: rgba(42, 157, 143, 0.2);
    --space-xs: 2px;
    --space-sm: 4px;
    --space-md: 8px;
    --space-lg: 12px;
    --space-xl: 16px;
    --space-2xl: 24px;
    --radius: 4px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    border-radius: 0;
}

html {
    font-size: 14px;
    line-height: 1.5;
    border: none;
}

body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    direction: rtl;
    text-align: right;
    min-height: 100vh;
    overflow-x: visible;
    border: none;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--accent);
}

/* ===== App Shell (CSS Grid Layout) ===== */
.app-shell {
    display: flex;
    min-height: 100vh;
    overflow-x: visible;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin-right: var(--sidebar-w);
}

.content-wrapper {
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: var(--space-lg);
    flex: 1;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header .logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), #3ab795);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    color: white;
}

.sidebar-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--surface);
    letter-spacing: -0.3px;
}

.sidebar-menu {
    list-style: none;
    flex: 1;
    padding: 16px 12px;
    overflow: visible !important;
}

.sidebar-menu li {
    margin-bottom: 4px;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 400;
}

.sidebar-menu li a .icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: var(--sidebar-hover);
    color: var(--surface);
}

.sidebar-menu li a.active {
    background: var(--sidebar-active);
    border-right: 3px solid var(--accent);
}

.sidebar-menu li a.active .icon {
    color: var(--accent);
}

/* Dropdown in sidebar - hidden by default */
.sidebar-menu .dropdown-menu,
.sidebar .dropdown-menu {
    display: none;
    position: absolute;
    background: rgba(0,0,0,0.95);
    border-radius: 8px;
    margin-top: 0;
    padding: 8px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: none;
    min-width: 200px;
    z-index: 1000;
    right: 0;
}

/* Show dropdown on hover - use !important to override inline style */
.sidebar-menu .dropdown:hover .dropdown-menu,
.sidebar .dropdown:hover > .dropdown-menu {
    display: block !important;
}

/* Dropdown items */
.sidebar-menu .dropdown-menu a,
.sidebar .dropdown-menu a {
    padding: 10px 20px 10px 16px;
    font-size: 13px;
    color: rgba(255,255,255,0.8);
    border-right: none;
}

.sidebar-menu .dropdown-menu a:hover {
    background: var(--sidebar-hover);
    border-right: none;
}

.sidebar-menu .dropdown > a.dropdown-toggle {
    justify-content: flex-start;
}

/* Dropdown toggle arrow */
.sidebar-menu .dropdown > a.dropdown-toggle span:last-child {
    margin-right: auto;
    font-size: 10px;
    opacity: 0.7;
}

.sidebar-menu .dropdown:hover > a.dropdown-toggle span:last-child {
    opacity: 1;
}

/* Dropdown toggle sub-menu headers */
.sidebar .dropdown-menu .dropdown-toggle-sub {
    color: rgba(255,255,255,0.9) !important;
    font-weight: bold !important;
    cursor: default !important;
    pointer-events: none !important;
}

.sidebar .dropdown-menu .dropdown-toggle-sub:hover {
    background: transparent !important;
}

.sidebar .dropdown-menu a {
    color: rgba(255,255,255,0.7) !important;
    font-size: 13px !important;
    padding: 10px 16px !important;
    display: flex !important;
    align-items: center;
    gap: 10px;
    text-decoration: none !important;
    border-radius: 0;
    border-right: none !important;
}

.sidebar .dropdown-menu a:hover {
    background: var(--sidebar-hover) !important;
    color: #fff !important;
    border-right: none !important;
}

.sidebar .dropdown-menu a .icon {
    font-size: 14px;
    width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.1);
}

.sidebar-footer .user-info {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--surface);
}

.sidebar-footer .user-role {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    text-transform: capitalize;
}

.sidebar-footer .btn-logout {
    margin-top: 12px;
    width: 100%;
    padding: 10px;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sidebar-footer .btn-logout:hover {
    background: rgba(220, 38, 38, 0.2);
    color: #fca5a5;
}

/* ===== Top Bar ===== */
.top-bar {
    background: var(--surface);
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.top-bar-right {
    display: flex;
    align-items: center;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.datetime-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.date-display,
.time-display {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text);
    background: var(--bg);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.date-display.jalali-date {
    background: linear-gradient(135deg, #1E3A5F 0%, #2A4A6F 100%);
    border-color: var(--primary);
    color: white;
}

.date-display.jalali-date .date-label {
    color: #FFD700;
}

.date-label,
.time-label {
    font-size: 14px;
}

#clock {
    font-family: 'Vazirmatn', monospace;
    font-weight: 600;
    font-size: 14px;
    color: var(--primary);
}

.notif-btn {
    position: relative;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.notif-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.notif-btn:hover #notif-badge {
    background: white;
    color: var(--primary);
}

#notif-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    display: none;
}

#notif-badge.active {
    display: block;
}

.top-bar h1 {
    font-size: 14px;
    font-weight: 600;
}

/* ===== Cards ===== */
.card {
    background: var(--surface);
    border-radius: 4px;
    padding: var(--space-sm);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    margin-bottom: var(--space-sm);
    overflow-x: visible;
    min-width: 0;
    border: none;
}

.card h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: var(--space-md);
    color: var(--text);
}

/* ===== Card Grid ===== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.stat-card {
    background: var(--surface);
    border-radius: 8px;
    padding: var(--space-md);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    text-align: center;
    border: none;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .label {
    font-size: 12px;
    color: var(--text-meta);
    margin-top: var(--space-xs);
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: 500;
    font-size: 14px;
}

.form-row {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 180px;
}

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    background: var(--surface);
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30,58,95,0.1);
}

/* ===== Buttons ===== */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    display: inline-block;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    color: var(--surface);
}

.btn-secondary,
.btn-accent {
    background: var(--accent);
    color: var(--surface);
}

.btn-danger {
    background: var(--danger);
    color: var(--surface);
}

.btn-success {
    background: var(--success);
    color: var(--surface);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

/* ===== Tables ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.data-table th,
.data-table td {
    padding: 8px var(--space-sm);
    text-align: right;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    min-width: auto;
    width: auto;
}

.data-table th {
    background: var(--bg);
    font-weight: 500;
    font-size: 12px;
    color: var(--text-meta);
}

.data-table tr:hover {
    background: var(--bg);
}

/* ===== Responsive Table ===== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Force horizontal scroll on desktop */
@media (min-width: 769px) {
    .table-responsive {
        overflow-x: scroll !important;
    }
}

@media (max-width: 480px) {
    .data-table {
        font-size: 12px;
    }

    .data-table thead {
        display: none;
    }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table tr {
        margin-bottom: 12px;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        background: var(--surface);
    }

    .data-table td {
        padding: 8px 12px;
        text-align: right;
        border-bottom: 1px solid var(--border);
    }

    .data-table td:last-child {
        border-bottom: none;
    }

    .data-table td::before {
        content: attr(data-label);
        font-weight: bold;
        margin-left: 8px;
        color: var(--primary);
    }

    .data-table td:empty::before {
        display: none;
    }

    .data-table .btn {
        width: 100%;
        margin-top: 8px;
    }
}

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #D1FAE5;
    color: #065F46;
}

.badge-warning {
    background: #FEF3C7;
    color: #92400E;
}

.badge-danger {
    background: #FEE2E2;
    color: #991B1B;
}

.badge-info {
    background: #DBEAFE;
    color: #1E40AF;
}

.badge-default {
    background: #E2E8F0;
    color: #475569;
}

.badge-accent {
    background: rgba(42, 157, 143, 0.15);
    color: var(--accent);
}

/* ===== Score Bar ===== */
.score-bar {
    display: inline-block;
    width: 80px;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    vertical-align: middle;
    margin-right: 8px;
}

.score-fill {
    height: 100%;
    background: var(--success);
}

.score-fill.low {
    background: var(--danger);
}

.score-fill.mid {
    background: var(--warning);
}

/* ===== Auth Pages ===== */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, #2A4A7F 100%);
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: var(--space-md);
}

.auth-card {
    background: var(--surface);
    border-radius: 8px;
    padding: var(--space-xl);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    text-align: center;
}

.auth-card h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.auth-card h2 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-meta);
    margin-bottom: var(--space-lg);
}

.auth-card form {
    text-align: right;
}

.auth-link {
    margin-top: var(--space-md);
    font-size: 14px;
}

.auth-link a {
    font-weight: 500;
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: 8px;
    padding: var(--space-lg);
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}

/* ===== Card Detail Modal ===== */
.card-detail-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.card-detail-overlay.active {
    display: flex;
}

.card-detail-panel {
    background: var(--surface);
    border-radius: 12px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

.card-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
}

.card-detail-title-section {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-id-badge {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.card-title-input {
    font-size: 18px;
    font-weight: bold;
    border: none;
    background: transparent;
    flex: 1;
    padding: 8px;
    border-radius: 4px;
    color: var(--text);
}

.card-title-input:focus {
    outline: none;
    background: white;
    box-shadow: 0 0 0 2px var(--accent);
}

.card-detail-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.card-detail-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    background: #fafbfc;
}

.tab-btn {
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-meta);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.card-detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.card-detail-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: #fafbfc;
}

/* ===== Form Elements ===== */
.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text);
    font-size: 13px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.1);
}

/* ===== Progress Bar ===== */
.progress-bar-mini {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

#cardProgress {
    width: 100%;
    height: 8px;
    cursor: pointer;
}

/* ===== Assignees ===== */
.assignees-container {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    background: #fafbfc;
}

.assignees-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    min-height: 32px;
}

.assignee-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #e0e7ff;
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 13px;
}

.assignee-tag button {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 0;
    font-size: 14px;
    line-height: 1;
}

.assignee-tag button:hover {
    color: var(--danger);
}

.user-search-wrapper {
    position: relative;
}

.user-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.user-search-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.user-search-item:hover {
    background: #f3f4f6;
}

.user-search-item:last-child {
    border-bottom: none;
}

/* ===== Labels ===== */
.labels-container {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    background: #fafbfc;
}

.labels-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    min-height: 24px;
}

.label-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--accent);
    color: white;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
}

.label-tag:hover {
    opacity: 0.8;
}

/* ===== Checklist ===== */
.checklist-container {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    background: #fafbfc;
}

.checklist-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.checklist-items {
    margin-bottom: 12px;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.checklist-item:last-child {
    border-bottom: none;
}

.checklist-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checklist-item span {
    flex: 1;
    font-size: 14px;
}

.checklist-item span.checked {
    text-decoration: line-through;
    color: var(--text-meta);
}

.btn-icon-small {
    background: none;
    border: none;
    color: var(--text-meta);
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
}

.btn-icon-small:hover {
    color: var(--danger);
}

.checklist-add {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.checklist-add input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}

.checklist-add button {
    padding: 12px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}

.checklist-add button:hover {
    background: var(--primary-dark);
}

/* ===== Attachments ===== */
.attachments-container {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    background: #fafbfc;
}

.attachments-list {
    margin-bottom: 12px;
}

.attachment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: white;
    border-radius: 4px;
    margin-bottom: 8px;
}

.attachment-upload {
    text-align: center;
}

.attachment-upload input[type="file"] {
    display: none;
}

/* ===== Comments & Activity ===== */
.comment-form {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.comment-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 10px;
    resize: vertical;
    font-family: inherit;
}

.activity-section h4 {
    margin-bottom: 12px;
    color: var(--text);
}

.activity-timeline {
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    font-size: 18px;
}

.activity-content {
    flex: 1;
}

.activity-content strong {
    display: block;
    margin-bottom: 4px;
}

.activity-content small {
    display: block;
    color: var(--text-meta);
    margin-top: 4px;
    font-size: 12px;
}

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.badge-gray { background: #e5e7eb; color: #374151; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #d1fae5; color: #047857; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-yellow { background: #fef3c7; color: #d97706; }
.badge-warning { background: #fef3c7; color: #92400e; }

/* ===== Buttons ===== */
.btn-icon {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #f3f4f6;
    border-color: var(--accent);
}

.btn-icon.btn-danger {
    color: var(--danger);
}

.btn-icon.btn-danger:hover {
    background: #fee2e2;
    border-color: var(--danger);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    :root {
        --sidebar-w: 220px;
    }

    .sidebar {
        width: var(--sidebar-w);
    }

    .sidebar-menu {
        padding: 10px;
    }

    .sidebar-menu li a {
        padding: 12px 14px;
        font-size: 13px;
    }

    .sidebar-menu li a .icon {
        font-size: 16px;
    }

    /* Dropdown menu responsive */
    .sidebar .dropdown-menu {
        position: fixed;
        right: var(--sidebar-w);
        top: auto;
        min-width: 180px;
        max-height: 80vh;
        overflow-y: auto;
    }

    .card-detail-panel {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .card-detail-overlay {
        padding: 0;
    }

    .card-detail-header {
        flex-direction: column;
        gap: 12px;
    }

    .card-detail-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .card-detail-tabs {
        overflow-x: auto;
        padding: 0 12px;
    }

    .tab-btn {
        padding: 10px 14px;
        white-space: nowrap;
        font-size: 13px;
    }

    .card-detail-body {
        padding: 16px;
    }

    .form-row-2 {
        grid-template-columns: 1fr;
    }

    .card-detail-footer {
        flex-wrap: wrap;
    }

    .card-detail-footer .btn {
        flex: 1;
        min-width: 100px;
    }
}

@media (max-width: 480px) {
    .card-detail-title-section {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-title-input {
        font-size: 16px;
    }

    .assignees-list,
    .labels-list {
        gap: 6px;
    }

    .assignee-tag,
    .label-tag {
        font-size: 11px;
        padding: 3px 8px;
    }
}

.modal-close {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    font-size: 28px;
    cursor: pointer;
    color: var(--text-meta);
    background: none;
    border: none;
}

.modal-close:hover {
    color: var(--text);
}

/* ===== Skill Requirement Row ===== */
.skill-req-row {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    margin-bottom: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg);
    border-radius: 8px;
}

.skill-req-row select {
    flex: 1;
}

.skill-req-row .btn {
    flex-shrink: 0;
}

/* ===== Gap List ===== */
.gap-list {
    list-style: none;
    margin-top: var(--space-sm);
}

.gap-list li {
    padding: 10px var(--space-sm);
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: var(--space-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ===== Toast ===== */
#toast-container {
    position: fixed;
    bottom: var(--space-lg);
    left: var(--space-lg);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px var(--space-md);
    border-radius: 8px;
    color: var(--surface);
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease;
    min-width: 250px;
}

.toast-success {
    background: var(--success);
}

.toast-error {
    background: var(--danger);
}

.toast-info {
    background: var(--primary);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-meta);
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: var(--space-sm);
}

/* ===== Utility Classes ===== */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-meta);
}

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

.mt-1 { margin-top: var(--space-sm); }
.mt-2 { margin-top: var(--space-md); }
.mt-3 { margin-top: var(--space-lg); }

.mb-1 { margin-bottom: var(--space-sm); }
.mb-2 { margin-bottom: var(--space-md); }
.mb-3 { margin-bottom: var(--space-lg); }

.d-flex {
    display: flex;
}

.d-flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-1 { gap: var(--space-sm); }
.gap-2 { gap: var(--space-md); }
.gap-3 { gap: var(--space-lg); }

/* ===== Page Header ===== */
.page-header {
    margin-bottom: var(--space-sm);
}

.page-header h1 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.page-header p {
    font-size: 12px;
    color: var(--text-meta);
}

/* ===== Section ===== */
.section {
    margin-bottom: var(--space-xl);
}

.section-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: var(--space-md);
    color: var(--text);
}

/* ===== Responsive (Mobile) ===== */
@media (max-width: 768px) {
    .app-shell {
        flex-direction: column;
    }

    .app-main {
        flex: 1;
        margin-right: 0;
    }

    .top-bar {
        flex-direction: column;
        gap: 10px;
        padding: 10px 16px;
    }

    .top-bar-left {
        width: 100%;
        justify-content: space-between;
    }

    .datetime-group {
        gap: 8px;
    }

    .date-display,
    .time-display {
        padding: 4px 8px;
        font-size: 11px;
    }

    .content-wrapper {
        overflow-x: visible;
        padding: var(--space-sm);
    }

    .table-responsive {
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
        width: 100vw;
        margin: 0 calc(-1 * var(--space-sm));
        padding: 0 var(--space-sm);
    }

    .data-table {
        font-size: 13px;
        min-width: 600px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }
}

/* ===== Kanban Board Styles ===== */
.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 16px 0;
    align-items: flex-start;
}

.kanban-column {
    min-width: 320px;
    max-width: 320px;
    background: #f3f4f6;
    border-radius: 10px;
    padding: 14px;
    flex-shrink: 0;
}

.kanban-column .column-cards {
    min-height: 100px;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

.kanban-card {
    background: white;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
    cursor: grab;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.empty-column {
    text-align: center;
    color: #999;
    padding: 20px;
    font-size: 12px;
    border: 2px dashed #e5e7eb;
    border-radius: 6px;
}

/* Drag over effect */
.kanban-column.drag-over {
    background: #e0f2fe;
    border: 2px dashed #3b82f6;
}

/* Board Header */
.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.board-stats {
    display: flex;
    gap: 16px;
}

.board-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-meta);
}

.board-stat strong {
    color: var(--text);
}

/* View Toggles */
.view-toggles {
    display: flex;
    gap: 8px;
}

.view-toggle {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.view-toggle:hover {
    border-color: var(--accent);
}

.view-toggle.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Search and Filter */
.board-filters {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 12px;
    color: var(--text-meta);
}

.filter-group select,
.filter-group input {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
    .kanban-column {
        min-width: 260px;
    }

    .board-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .board-filters {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group select,
    .filter-group input {
        flex: 1;
    }
}

/* ===== Board Modal - Full Width ===== */
.board-modal-content {
    max-width: 100% !important;
    width: 100% !important;
    max-height: 95vh !important;
    padding: 20px !important;
}

/* ===== Card Detail - Inline Panel ===== */
.card-detail-panel-inline {
    display: none;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    margin-top: 16px;
    overflow: hidden;
}

.card-detail-panel-inline.active {
    display: block;
}

.card-detail-panel-inline .card-detail-header {
    background: #f8fafc;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-detail-panel-inline .card-detail-tabs {
    background: #f8fafc;
    padding: 0 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    gap: 0;
}

.card-detail-panel-inline .tab-btn {
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: #6b7280;
    border-bottom: 2px solid transparent;
}

.card-detail-panel-inline .tab-btn.active {
    color: #2a9d8f;
    border-bottom-color: #2a9d8f;
}

.card-detail-panel-inline .card-detail-body {
    padding: 20px;
    max-height: calc(80vh - 200px);
    overflow-y: auto;
}

.card-detail-panel-inline .card-detail-footer {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Inline close button */
.inline-card-close {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #e5e7eb;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Product UI refresh: shared visual system ===== */
:root {
    --primary: #334155;
    --primary-dark: #0f172a;
    --primary-light: #e8eef7;
    --accent: #0f766e;
    --accent-soft: #e6f6f3;
    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-subtle: #f8fafc;
    --border: #e2e8f0;
    --text: #172033;
    --text-meta: #64748b;
    --danger: #dc2626;
    --warning: #b45309;
    --success: #047857;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
    --shadow-md: 0 12px 28px rgba(15, 23, 42, .08);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
}

html {
    scroll-behavior: smooth;
}

body {
    background:
        radial-gradient(circle at 90% -10%, rgba(13, 148, 136, .08), transparent 26rem),
        var(--bg);
    color: var(--text);
    line-height: 1.65;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(13, 148, 136, .35);
    outline-offset: 2px;
}

.skip-link {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 5000;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--primary-dark);
    color: #fff;
    transform: translateY(-160%);
    transition: transform .18s ease;
}

.skip-link:focus {
    transform: translateY(0);
    color: #fff;
}

.app-main {
    margin-right: var(--sidebar-w);
}

.content-wrapper {
    max-width: 1680px;
    padding: 28px clamp(20px, 3vw, 44px) 40px;
}

.sidebar {
    background: linear-gradient(180deg, #172033 0%, #0f172a 100%);
    border-left: 1px solid rgba(255, 255, 255, .08);
    box-shadow: -12px 0 28px rgba(15, 23, 42, .12);
}

.sidebar-header {
    padding: 24px 20px;
}

.sidebar-header .logo {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    background: linear-gradient(135deg, #14b8a6, #0f766e);
    box-shadow: 0 8px 20px rgba(20, 184, 166, .22);
}

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

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu li a {
    min-height: 44px;
    border-radius: 10px;
    color: rgba(255, 255, 255, .68);
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.sidebar-menu li a.active {
    border-right: 0;
    box-shadow: inset -3px 0 0 #2dd4bf;
}

.sidebar-menu .dropdown-menu,
.sidebar .dropdown-menu {
    right: 12px;
    width: calc(100% - 24px);
    margin-top: 2px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 12px;
    background: #202b40;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .25);
}

.top-bar {
    min-height: 72px;
    padding: 14px clamp(20px, 3vw, 44px);
    border-bottom: 1px solid rgba(226, 232, 240, .9);
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(14px);
}

.top-bar-right,
.top-bar-left {
    gap: 12px;
}

.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 19px;
}

.datetime-group {
    gap: 8px;
}

.date-display,
.time-display,
.notif-btn {
    border-color: var(--border);
    border-radius: 10px;
    background: var(--surface-subtle);
}

.date-display.jalali-date {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.notif-btn {
    width: 40px;
    height: 40px;
    padding: 0;
}

.notif-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1,
.top-bar h1 {
    color: var(--text);
    font-size: clamp(20px, 2vw, 25px);
    font-weight: 750;
    letter-spacing: -.025em;
}

.page-header p {
    margin-top: 4px;
    font-size: 14px;
}

.card {
    margin-bottom: 20px;
    padding: clamp(18px, 2.2vw, 26px);
    border: 1px solid rgba(226, 232, 240, .95);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card h3 {
    margin-bottom: 18px;
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
}

.card-grid,
.stats-grid {
    gap: 16px;
    margin-bottom: 20px;
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 20px;
    border: 1px solid rgba(226, 232, 240, .95);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    text-align: right;
    transition: transform .18s ease, box-shadow .18s ease;
}

.stat-card::after {
    position: absolute;
    top: 0;
    right: 0;
    width: 48px;
    height: 4px;
    border-radius: 0 0 0 10px;
    background: var(--accent);
    content: "";
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card .value {
    color: var(--text);
    font-size: 30px;
    line-height: 1.25;
}

.stat-card .label {
    margin-top: 8px;
    font-size: 13px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    margin-bottom: 7px;
    color: #334155;
    font-size: 13px;
    font-weight: 650;
}

input,
select,
textarea,
.form-group input,
.form-group select,
.form-group textarea {
    min-height: 44px;
    border-color: #cbd5e1;
    border-radius: 10px;
    color: var(--text);
    background: #fff;
}

textarea,
.form-group textarea {
    min-height: auto;
}

input::placeholder,
textarea::placeholder {
    color: #94a3b8;
}

input:focus,
select:focus,
textarea:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, .12);
}

.btn {
    min-height: 40px;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-weight: 650;
    line-height: 1.3;
    transition: transform .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.btn:hover {
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 5px 12px rgba(15, 23, 42, .12);
}

.btn-primary {
    background: var(--primary-dark);
}

.btn-primary:hover {
    background: #1e293b;
}

.btn-secondary,
.btn-accent {
    background: var(--accent);
}

.btn-secondary:hover,
.btn-accent:hover {
    background: #0b625b;
}

.btn-sm {
    min-height: 32px;
    padding: 6px 11px;
    border-radius: 8px;
}

.data-table {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 13px 16px;
    border-bottom-color: var(--border);
}

.data-table th {
    background: var(--surface-subtle);
    color: #475569;
    font-size: 12px;
    font-weight: 700;
}

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

.data-table tr:hover {
    background: #f8fafc;
}

.badge {
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.badge-accent {
    background: var(--accent-soft);
    color: #0f766e;
}

.empty-state {
    padding: 36px 20px;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    background: var(--surface-subtle);
}

.modal {
    padding: 20px;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(3px);
}

.modal-content {
    width: min(680px, 100%);
    padding: 28px;
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: var(--radius-lg);
    box-shadow: 0 22px 60px rgba(15, 23, 42, .25);
}

.modal-close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.auth-page {
    background:
        radial-gradient(circle at 18% 18%, rgba(45, 212, 191, .2), transparent 24rem),
        linear-gradient(135deg, #0f172a, #1e293b);
}

.auth-card {
    padding: 32px;
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 70px rgba(15, 23, 42, .3);
}

.auth-card h1 {
    color: var(--primary-dark);
    font-weight: 800;
}

@media (max-width: 768px) {
    body.nav-open {
        overflow: hidden;
    }

    body.nav-open::after {
        position: fixed;
        inset: 0;
        z-index: 900;
        background: rgba(15, 23, 42, .42);
        content: "";
    }

    .app-main {
        margin-right: 0;
    }

    .sidebar {
        width: min(300px, 84vw);
        transform: translateX(110%);
        transition: transform .22s ease;
        box-shadow: none;
    }

    .sidebar.is-open {
        transform: translateX(0);
        box-shadow: -14px 0 34px rgba(15, 23, 42, .3);
    }

    .top-bar {
        min-height: 64px;
        flex-direction: row;
        padding: 12px 16px;
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    .top-bar-left {
        width: auto;
    }

    .datetime-group .date-display:not(.jalali-date),
    .datetime-group .time-display {
        display: none;
    }

    .content-wrapper {
        padding: 20px 16px 32px;
    }

    .card {
        padding: 18px;
        border-radius: 12px;
    }

    .card-grid[style] {
        grid-template-columns: 1fr !important;
    }

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

    .stat-card {
        padding: 16px;
    }

    .stat-card .value {
        font-size: 24px;
    }

    .table-responsive {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .data-table {
        min-width: 560px;
    }

    .modal {
        padding: 12px;
    }

    .modal-content {
        padding: 22px 18px;
        border-radius: 14px;
    }
}

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

    .date-display.jalali-date {
        display: none;
    }

    .auth-card {
        padding: 24px 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

.inline-card-close:hover {
    background: #d1d5db;
}
