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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #ffffff;
    color: #1a202c;
    line-height: 1.6;
}

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

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-right: 1px solid #e2e8f0;
    padding: 24px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.logo {
    display: flex;
    align-items: center;
    padding: 0 24px 32px;
    color: #2563eb;
    font-weight: 700;
    font-size: 18px;
}

.logo i {
    font-size: 24px;
    margin-right: 12px;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: #e2e8f0;
    color: #334155;
}

.nav-item.active {
    background-color: #dbeafe;
    color: #2563eb;
    border-left-color: #2563eb;
    font-weight: 500;
}

.nav-item i {
    width: 20px;
    margin-right: 12px;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
    background-color: #ffffff;
}

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

.header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 4px;
}

.subtitle {
    color: #64748b;
    font-size: 16px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background-color: #2563eb;
    color: white;
}

.btn-primary:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    margin-right: 8px;
}

.btn-secondary:hover {
    background-color: #e2e8f0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #dbeafe;
    color: #2563eb;
    font-size: 20px;
}

.stat-icon.qualified {
    background-color: #dcfce7;
    color: #16a34a;
}

.stat-icon.score {
    background-color: #fef3c7;
    color: #d97706;
}

.stat-icon.urgent {
    background-color: #fecaca;
    color: #dc2626;
}

.stat-info h3 {
    font-size: 24px;
    font-weight: 700;
    color: #1a202c;
}

.stat-info p {
    color: #64748b;
    font-size: 14px;
}

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

.card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.card h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 16px;
}

.tab-content {
    display: none;
}

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

.filter-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.filter-bar select,
.filter-bar input {
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
}

.filter-bar input {
    flex: 1;
    max-width: 300px;
}

.table-container {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
    position: sticky;
    top: 0;
    z-index: 10;
}

table td {
    font-size: 14px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-new {
    background-color: #f3f4f6;
    color: #374151;
}

.status-contacted {
    background-color: #dbeafe;
    color: #2563eb;
}

.status-qualified {
    background-color: #dcfce7;
    color: #16a34a;
}

.status-closed {
    background-color: #f3e8ff;
    color: #7c3aed;
}

.score-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
}

.score-high {
    background-color: #dcfce7;
    color: #16a34a;
}

.score-medium {
    background-color: #fef3c7;
    color: #d97706;
}

.score-low {
    background-color: #fecaca;
    color: #dc2626;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    padding: 20px 0;
}

.modal-content {
    background-color: white;
    margin: 0 auto;
    padding: 32px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    margin-top: 20px;
    margin-bottom: 20px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1a202c;
}

.close {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #64748b;
    background: none;
    border: none;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close:hover {
    color: #1a202c;
    background-color: #f1f5f9;
    border-radius: 4px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #374151;
}

.required {
    color: #dc2626;
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.lead-list {
    space-y: 12px;
}

.lead-item {
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
}

.lead-item h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.lead-item p {
    font-size: 12px;
    color: #64748b;
}

.task-list .task-item {
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.task-item i {
    color: #64748b;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
    margin: 12px 0;
}

.progress {
    height: 100%;
    background-color: #10b981;
    transition: width 0.3s ease;
}

.recommendations {
    list-style: none;
}

.recommendations li {
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #374151;
}

.recommendations i {
    color: #f59e0b;
}

.activity-type-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.activity-call {
    background-color: #dbeafe;
    color: #2563eb;
}

.activity-email {
    background-color: #dcfce7;
    color: #16a34a;
}

.activity-meeting {
    background-color: #fef3c7;
    color: #d97706;
}

.activity-demo {
    background-color: #f3e8ff;
    color: #7c3aed;
}

.activity-proposal {
    background-color: #fecaca;
    color: #dc2626;
}

.activity-item {
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.activity-item:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

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

.activity-date {
    font-size: 12px;
    color: #64748b;
}

.activity-content h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #1a202c;
}

.activity-content p {
    font-size: 13px;
    color: #64748b;
    margin: 0;
}

.manual-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.manual-section {
    margin-bottom: 24px;
}

.manual-section h4 {
    color: #1a202c;
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: 600;
}

.manual-section p {
    color: #64748b;
    margin-bottom: 12px;
}

.manual-section ul {
    list-style: none;
    padding-left: 0;
}

.manual-section li {
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    color: #374151;
}

.manual-section li:last-child {
    border-bottom: none;
}

.status-guide {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.status-item p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

.tips-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tip-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background-color: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
}

.tip-item i {
    color: #3b82f6;
    margin-top: 2px;
}

.tip-item h5 {
    margin: 0 0 4px 0;
    color: #1a202c;
    font-size: 14px;
    font-weight: 600;
}

.tip-item p {
    margin: 0;
    color: #64748b;
    font-size: 13px;
}

.faq-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.faq-item {
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.faq-item h5 {
    margin: 0 0 8px 0;
    color: #1a202c;
    font-size: 14px;
    font-weight: 600;
}

.faq-item p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

/* Lead card styles - similar to activity management */
.leads-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.lead-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.lead-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.lead-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.lead-card .company-info h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
}

.lead-card .contact-details {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.lead-card .contact-name {
    font-size: 14px;
    color: #475569;
    font-weight: 500;
}

.lead-card .email {
    font-size: 13px;
    color: #64748b;
}

.lead-card .status-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.lead-card .card-body {
    margin-bottom: 16px;
}

.lead-card .industry-info,
.lead-card .follow-up-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    color: #64748b;
}

.lead-card .industry-info i,
.lead-card .follow-up-info i {
    color: #94a3b8;
    width: 16px;
}

.lead-card .notes-section,
.lead-card .ai-comments-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

.lead-card .notes-section h4,
.lead-card .ai-comments-section h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lead-card .notes-section p {
    margin: 0;
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
}

.lead-card .ai-comments-section {
    background: #f8fafc;
    margin: 16px -20px 0;
    padding: 16px 20px;
    border-top: 1px solid #e2e8f0;
    border-radius: 0 0 12px 12px;
}

.lead-card .ai-comments-section h4 {
    color: #2563eb;
}

.lead-card .ai-content {
    font-size: 14px;
    color: #475569;
    line-height: 1.5;
}

.lead-card .card-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

/* デスクトップではモバイルカードを非表示 */
.mobile-card {
    display: none;
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

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

    .filter-bar {
        flex-direction: column;
    }

    .filter-bar input {
        max-width: none;
    }

    /* テーブル モバイル対応 */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table th,
    table td {
        padding: 8px 4px;
        font-size: 12px;
        white-space: nowrap;
    }

    /* AIコメント列をモバイルでは非表示 */
    table th:nth-child(8),
    table td:nth-child(8) {
        display: none;
    }

    /* 活動テーブルのAIコメント列も非表示 */
    #activitiesTable th:nth-child(5),
    #activitiesTable td:nth-child(5) {
        display: none;
    }

    /* モーダル モバイル対応 */
    .modal-content {
        width: 95%;
        margin: 10px auto;
        padding: 20px;
        max-height: calc(100vh - 20px);
    }

    /* ボタン モバイル対応 */
    .btn {
        padding: 8px 12px;
        font-size: 14px;
    }

    /* AIコメント表示エリア */
    #edit_ai_comments {
        font-size: 12px;
        padding: 8px;
        min-height: 40px;
    }

    /* モバイル専用カード表示 */
    .mobile-card {
        display: block;
        background: white;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        padding: 12px;
        margin-bottom: 12px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    .mobile-card h4 {
        margin: 0 0 8px 0;
        font-size: 16px;
        font-weight: 600;
        color: #1a202c;
    }

    .mobile-card .card-info {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 8px;
    }

    .mobile-card .info-tag {
        background: #f1f5f9;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 12px;
        color: #475569;
    }

    .mobile-card .ai-section {
        background: #f0f9ff;
        padding: 8px;
        border-radius: 4px;
        border-left: 3px solid #2563eb;
        margin-top: 8px;
        font-size: 12px;
        color: #2563eb;
    }

    .mobile-card .actions {
        margin-top: 12px;
        display: flex;
        gap: 8px;
    }

    .mobile-card .btn {
        flex: 1;
        text-align: center;
        padding: 6px 8px;
        font-size: 12px;
    }

    /* テーブルをモバイルでは非表示 */
    .table-container table {
        display: none;
    }

    /* Lead cards mobile responsive */
    .lead-card {
        padding: 16px;
        margin-bottom: 12px;
    }

    .lead-card .card-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .lead-card .status-info {
        flex-direction: row;
        align-items: center;
        align-self: stretch;
        justify-content: space-between;
    }

    .lead-card .contact-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .lead-card .ai-comments-section {
        margin: 16px -16px 0;
        padding: 12px 16px;
    }

    .lead-card .card-actions {
        flex-direction: column;
    }

    .lead-card .card-actions .btn {
        width: 100%;
        justify-content: center;
    }
}