/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f5f7; color: #1d1d1f; font-size: 14px; }
a { color: #0071e3; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ── */
.navbar { display: flex; align-items: center; justify-content: space-between; background: #1d1d1f; color: #f5f5f7; padding: 0 24px; height: 48px; }
.nav-brand { font-weight: 600; font-size: 15px; color: #f5f5f7; }
.nav-links a { color: #a1a1a6; margin-left: 20px; font-size: 13px; }
.nav-links a:hover { color: #f5f5f7; text-decoration: none; }

/* ── Stats Bar ── */
.stats-bar { display: flex; align-items: center; gap: 24px; background: #fff; border-bottom: 1px solid #e0e0e5; padding: 8px 24px; font-size: 13px; }
.stat-label { color: #6e6e73; margin-right: 4px; }
#live-clock { font-variant-numeric: tabular-nums; }

/* ── Alerts ── */
.alert { padding: 10px 16px; border-radius: 8px; margin: 12px 24px 0; font-size: 13px; }
.alert-success { background: #d1f5e0; color: #155724; }
.alert-error, .alert-danger { background: #fde8e8; color: #721c24; }
.alert-info { background: #e8f4fd; color: #004085; }

/* ── Main Content ── */
.main-content { padding: 24px; }

/* ── Buttons ── */
.btn { display: inline-block; padding: 7px 16px; border-radius: 8px; border: none; cursor: pointer; font-size: 13px; font-weight: 500; transition: opacity 0.15s; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: #0071e3; color: #fff; }
.btn-primary:hover { background: #0077ed; }
.btn-secondary { background: #e8e8ed; color: #1d1d1f; }
.btn-secondary:hover { background: #d8d8dd; }
.btn-danger { background: #ff3b30; color: #fff; }
.btn-success { background: #34c759; color: #fff; }

/* ── Dashboard Layout ── */
.dashboard-layout { display: grid; grid-template-columns: 340px 1fr; gap: 16px; height: calc(100vh - 120px); }

/* ── Card Panel ── */
.card-panel { background: #fff; border-radius: 12px; border: 1px solid #e0e0e5; display: flex; flex-direction: column; overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid #e0e0e5; }
.panel-header h2 { font-size: 15px; font-weight: 600; }
.card-list { flex: 1; overflow-y: auto; }
.job-card { padding: 12px 16px; border-bottom: 1px solid #f0f0f5; cursor: pointer; transition: background 0.1s; }
.job-card:hover, .job-card.active { background: #f5f5f7; }
.card-sender { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.card-subject { font-size: 12px; color: #6e6e73; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { display: flex; gap: 8px; align-items: center; }
.card-nav { display: flex; justify-content: space-between; padding: 10px 16px; border-top: 1px solid #e0e0e5; }

/* ── Action Labels ── */
.action-label { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.action-reply { background: #d1f5e0; color: #155724; }
.action-naukri { background: #fff3cd; color: #856404; }
.action-portal { background: #e8f4fd; color: #004085; }
.action-low_confidence { background: #fff3cd; color: #856404; border: 1px solid #ffc107; }
.action-pending { background: #f0f0f5; color: #6e6e73; }

/* ── Status Badges ── */
.status-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.status-pending { background: #f0f0f5; color: #6e6e73; }
.status-approved, .status-sent, .status-completed { background: #d1f5e0; color: #155724; }
.status-skipped { background: #e8e8ed; color: #6e6e73; }
.status-failed { background: #fde8e8; color: #721c24; }
.status-handed_off { background: #e8f4fd; color: #004085; }

/* ── Detail Panel ── */
.detail-panel { background: #fff; border-radius: 12px; border: 1px solid #e0e0e5; padding: 20px; overflow-y: auto; }
.detail-panel h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.detail-section { margin-bottom: 16px; }
.detail-section label { font-size: 11px; font-weight: 600; text-transform: uppercase; color: #6e6e73; letter-spacing: 0.5px; display: block; margin-bottom: 4px; }
.detail-body { font-size: 13px; line-height: 1.6; white-space: pre-wrap; background: #f5f5f7; padding: 12px; border-radius: 8px; }
.action-buttons { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ── Empty State ── */
.empty-state { color: #a1a1a6; text-align: center; padding: 40px 20px; font-size: 13px; }

/* ── Setup ── */
.setup-container { max-width: 480px; margin: 40px auto; background: #fff; border-radius: 12px; border: 1px solid #e0e0e5; padding: 32px; }
.setup-container h1 { font-size: 22px; margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #1d1d1f; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 8px 12px; border: 1px solid #d0d0d5; border-radius: 8px; font-size: 13px; background: #fff; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #0071e3; }
.form-group .hint { font-size: 11px; color: #6e6e73; margin-top: 4px; }
.form-actions { margin-top: 24px; }
.step-indicator { display: flex; gap: 8px; margin-bottom: 24px; }
.step-dot { width: 8px; height: 8px; border-radius: 50%; background: #e0e0e5; }
.step-dot.active { background: #0071e3; }
.step-dot.done { background: #34c759; }
.radio-group { display: flex; flex-direction: column; gap: 10px; }
.radio-option { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid #e0e0e5; border-radius: 8px; cursor: pointer; transition: border-color 0.15s; }
.radio-option:hover { border-color: #0071e3; }
.radio-option input { margin-top: 2px; }
.radio-option .option-label { font-weight: 600; font-size: 13px; }
.radio-option .option-hint { font-size: 12px; color: #6e6e73; margin-top: 2px; }

/* ── Profile ── */
.profile-container { max-width: 640px; margin: 0 auto; }
.profile-container h1 { font-size: 22px; margin-bottom: 24px; }
.profile-container h2 { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.profile-card { background: #fff; border-radius: 12px; border: 1px solid #e0e0e5; padding: 24px; margin-bottom: 20px; }
.profile-field { margin-bottom: 14px; }
.profile-field label { font-size: 11px; font-weight: 600; text-transform: uppercase; color: #6e6e73; letter-spacing: 0.5px; display: block; margin-bottom: 4px; }
.profile-field .field-value { font-size: 13px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; }
.tag { background: #f0f0f5; color: #1d1d1f; padding: 3px 10px; border-radius: 20px; font-size: 12px; }
.upload-section { background: #fff; border-radius: 12px; border: 1px solid #e0e0e5; padding: 24px; margin-bottom: 24px; }
.upload-form { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.upload-form input[type="file"] { font-size: 13px; }
.profile-fields { background: #fff; border-radius: 12px; border: 1px solid #e0e0e5; padding: 24px; }
.profile-empty { background: #fff; border-radius: 12px; border: 1px solid #e0e0e5; padding: 40px 24px; text-align: center; color: #a1a1a6; font-size: 13px; }
.field-group { margin-bottom: 18px; border-bottom: 1px solid #f0f0f5; padding-bottom: 14px; }
.field-group:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.field-group label { font-size: 11px; font-weight: 600; text-transform: uppercase; color: #6e6e73; letter-spacing: 0.5px; display: block; margin-bottom: 6px; }
.field-group .field-value { font-size: 13px; line-height: 1.5; }
.field-group .field-value ul { padding-left: 16px; }
.read-only-note { font-size: 12px; font-weight: 400; color: #a1a1a6; margin-left: 8px; text-transform: none; letter-spacing: 0; }
.hint { font-size: 11px; color: #6e6e73; margin-top: 6px; }

/* ── Log ── */
.log-container { max-width: 900px; }
.log-container h1 { font-size: 22px; margin-bottom: 16px; }
.today-count { font-size: 15px; margin-bottom: 16px; }
.date-filter { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; font-size: 13px; }
.log-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; border: 1px solid #e0e0e5; }
.log-table th { background: #f5f5f7; padding: 10px 14px; text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; color: #6e6e73; letter-spacing: 0.3px; }
.log-table td { padding: 10px 14px; border-top: 1px solid #f0f0f5; font-size: 13px; }
.log-table tr:hover td { background: #f9f9fb; }

/* ── Edit Input ── */
.edit-input-area { margin-top: 16px; }
.edit-input-area textarea { width: 100%; padding: 10px 12px; border: 1px solid #d0d0d5; border-radius: 8px; font-size: 13px; resize: vertical; min-height: 80px; }
.edit-input-area .btn { margin-top: 8px; }

/* ── Low-confidence flag ── */
.job-card.low-confidence { border-left: 3px solid #ffc107; }
.job-card.low-confidence .action-label { background: #fff3cd; color: #856404; border: 1px solid #ffc107; }

/* ── Job card selected state ── */
.job-card.selected { background: #eef2ff; border-left: 3px solid #4f46e5; }

/* ── Detail panel content ── */
.detail-content { padding: 20px; }
.detail-header { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.detail-email-meta { font-size: 13px; color: #555; margin-bottom: 16px; line-height: 1.7; }
.detail-section { margin-bottom: 20px; }
.detail-section h4 { font-size: 13px; font-weight: 600; color: #333; margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.email-body { background: #f7f7f9; border: 1px solid #e0e0e8; border-radius: 6px; padding: 12px; font-size: 12px; white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow-y: auto; }
.reply-text { background: #f0f7f0; border: 1px solid #c3e6cb; border-radius: 6px; padding: 12px; font-size: 12px; white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow-y: auto; }
.qa-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.qa-table th { background: #f5f5f8; text-align: left; padding: 7px 10px; border-bottom: 2px solid #e0e0e8; }
.qa-table td { padding: 7px 10px; border-bottom: 1px solid #eee; vertical-align: top; }
.qa-q { width: 45%; color: #444; }
.qa-a { color: #222; font-weight: 500; }
.portal-url { font-size: 14px; margin: 4px 0; }
.portal-url a { color: #4f46e5; text-decoration: underline; }
.portal-note { font-size: 12px; color: #777; margin-top: 6px; }
.low-confidence-note { background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px; padding: 14px; }
.low-confidence-note h4 { color: #92400e; }
.error-text { color: #dc2626; font-size: 13px; }
