:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
    transition: max-width 0.3s ease;
}

.container-sm {
    max-width: 800px;
}

.container-lg {
    max-width: 1400px;
}

.container-full {
    max-width: 95%;
}

img {
    max-width: 100%;
    height: auto;
}

/* Navbar */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
    text-decoration: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    margin-left: 1.5rem;
    font-weight: 500;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    border: 1px solid transparent;
    gap: 0.5rem;
}

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

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

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

.btn-outline {
    background-color: transparent;
    border-color: var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    background-color: var(--bg-body);
    border-color: var(--text-muted);
}

.btn-text {
    background-color: transparent;
    color: var(--text-muted);
    padding: 0.5rem;
}

.btn-text:hover {
    color: var(--text-main);
    background-color: var(--bg-body);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.status-new {
    background-color: #dbeafe;
    color: #1e40af;
}

.status-contacted {
    background-color: #fef9c3;
    color: #854d0e;
}

.status-meeting_scheduled {
    background-color: #e0e7ff;
    color: #3730a3;
}

.status-proposal_sent {
    background-color: #f3e8ff;
    color: #6b21a8;
}

.status-negotiation {
    background-color: #ffedd5;
    color: #9a3412;
}

.status-signed {
    background-color: #dcfce7;
    color: #166534;
}

.status-onboarding {
    background-color: #ccfbf1;
    color: #115e59;
}

.status-completed {
    background-color: #f1f5f9;
    color: #475569;
}

.status-lost {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-onboarded {
    background-color: #cffafe;
    color: #155e75;
}

.status-registered {
    background-color: #e0f2fe;
    color: #0369a1;
}

.status-added_patient {
    background-color: #ede9fe;
    color: #5b21b6;
}

.status-limited_usage {
    background-color: #fef3c7;
    color: #92400e;
}

.status-very_active {
    background-color: #d1fae5;
    color: #065f46;
}

.status-high_usage {
    background-color: #bbf7d0;
    color: #166534;
}

.status-feedbacker {
    background-color: #fce7f3;
    color: #9d174d;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.mt-4 {
    margin-top: 1.5rem;
}

.form-container {
    max-width: 500px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

input,
select,
textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-family: inherit;
    font-size: 0.95rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary);
    border-color: transparent;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Table */
.client-table {
    width: 100%;
    border-collapse: collapse;
}

.client-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.875rem;
}

.client-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

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

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

/* Detail Page */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.info-item label {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.info-item p {
    font-weight: 500;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.badge {
    background: var(--bg-body);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Timeline */
.timeline {
    margin-top: 1rem;
    position: relative;
    padding-left: 1.5rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-marker {
    position: absolute;
    left: -1.85rem;
    top: 1rem;
    width: 0.75rem;
    height: 0.75rem;
    background: var(--primary);
    border-radius: 50%;
    border: 2px solid white;
}

.timeline-notes {
    color: var(--text-main);
    font-size: 0.95rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state p {
    margin-bottom: 1rem;
}

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

.header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-section h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--text-muted);
}

.sort-link {
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.sort-link:hover {
    color: var(--primary);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.timeline-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
    align-items: center;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text-muted);
    transition: color 0.2s;
    display: flex;
    align-items: center;
}

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

.delete-update-btn:hover {
    color: #dc2626;
}

.btn-text-small {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    color: var(--primary);
    font-size: 0.875rem;
    transition: opacity 0.2s;
}

.btn-text-small:hover {
    opacity: 0.8;
}

.timeline-notes-edit .form-group {
    margin-bottom: 1rem;
}

.timeline-notes-edit label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.nested-replies {
    background: rgba(0, 0, 0, 0.02);
    padding: 1rem;
    border-radius: 0.375rem;
}

.reply-item {
    background: white;
    padding: 0.75rem;
    border-radius: 0.375rem;
}