body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.header h1 {
    font-size: 32px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* "Me" Indicator on person detail page */
.me-indicator {
    display: inline-flex;
    align-items: center;
    background: #4A90E2;
    color: white;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 16px;
    margin-top: 8px;
}

/* Controls Bar */
.controls-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

.filter-select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #4A90E2;
    color: white;
}

.btn-primary:hover {
    background: #357ABD;
}

.btn-secondary {
    background: #95A5A6;
    color: white;
}

.btn-secondary:hover {
    background: #7F8C8D;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
}

/* People List */
.people-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.person-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.person-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.person-card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.person-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    background: #4A90E2;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: 600;
    flex-shrink: 0;
}

.person-info h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.person-info .nickname {
    font-size: 14px;
    color: #666;
    font-style: italic;
}

.person-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    color: #666;
}

.person-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.person-relationships {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-size: 13px;
    color: #999;
}

/* "Me" Badge */
.me-badge {
    display: inline-flex;
    align-items: center;
    background: #4A90E2;
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    margin-left: 8px;
    vertical-align: middle;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state p {
    font-size: 18px;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-dialog {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #333;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.modal-body input,
.modal-body select,
.modal-body textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 15px;
    font-family: inherit;
}

.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.modal-body textarea {
    resize: vertical;
    min-height: 80px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #e0e0e0;
}

.modal-footer .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.modal-footer .btn-secondary {
    background-color: #6c757d;
    color: white;
}

.modal-footer .btn-secondary:hover {
    background-color: #5a6268;
}

.modal-footer .btn-primary {
    background-color: #007bff;
    color: white;
}

.modal-footer .btn-primary:hover {
    background-color: #0056b3;
}

/* === PERSON DETAIL PAGE === */

/* Tabs */
.tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 20px;
    border-bottom: 2px solid #ddd;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #4A90E2;
}

.tab-btn.active {
    color: #4A90E2;
    border-bottom-color: #4A90E2;
}

/* Tab Panels */
.tab-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Form Section */
.form-section {
    max-width: 800px;
}

.photo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}

.person-photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
}

.photo-placeholder {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: #4A90E2;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 48px;
    font-weight: 600;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    font-size: 14px;
    color: #555;
}

.form-input {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    display: none;
}

.form-value {
    padding: 10px 12px;
    font-size: 16px;
    color: #333;
    min-height: 42px;
    display: flex;
    align-items: center;
}

/* Edit Mode */
body.edit-mode .form-input {
    display: block;
}

body.edit-mode .form-value {
    display: none;
}

body.edit-mode #upload-photo-btn,
body.edit-mode #add-relationship-btn,
body.edit-mode #add-attribute-btn,
body.edit-mode #add-transaction-btn,
body.edit-mode #add-note-btn {
    display: inline-block !important;
}

body.edit-mode #edit-btn {
    display: none !important;
}

body.edit-mode #save-btn,
body.edit-mode #cancel-btn {
    display: inline-block !important;
}

body.edit-mode .item-actions {
    display: flex;
}

/* Subsection */
.subsection {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.subsection h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
}

/* List Container */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 15px;
}

.list-item {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 15px;
}

.list-item-content {
    flex: 1;
}

.list-item-label {
    font-weight: 600;
    font-size: 14px;
    color: #555;
    margin-bottom: 4px;
}

.list-item-value {
    font-size: 16px;
    color: #333;
}

.list-item-meta {
    font-size: 13px;
    color: #999;
    margin-top: 4px;
}

.item-actions {
    display: none;
    gap: 8px;
    flex-shrink: 0;
}

/* Input Groups for inline editing */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.input-group label {
    font-weight: 600;
    font-size: 13px;
    color: #555;
}

.input-group input,
.input-group select,
.input-group textarea {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.input-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Danger Zone */
.danger-zone {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e74c3c;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        margin-top: 70px;
    }

    .header h1 {
        font-size: 24px;
    }

    .people-list {
        grid-template-columns: 1fr;
    }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        flex-shrink: 0;
        min-width: 100px;
    }

    .tab-content {
        padding: 20px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}