/* ============================================================
   Sales Rep Dashboard — Clean, functional, mobile-friendly
   ============================================================ */

:root {
    --bg: #f8f9fa;
    --surface: #ffffff;
    --border: #e2e5e9;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0891b2;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

header {
    background: var(--text);
    color: white;
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

header h1 {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

nav { display: flex; gap: 4px; flex-wrap: wrap; }

nav a {
    color: rgba(255,255,255,0.7);
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}

nav a:hover, nav a.active {
    color: white;
    background: rgba(255,255,255,0.12);
    text-decoration: none;
}

main { padding: 24px 0; }

/* ---------- Cards ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}

.card h2 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.card h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* ---------- Stats Row ---------- */

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

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.stat-card .number {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ---------- Pipeline Badge ---------- */

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-discovered { background: #dbeafe; color: #1e40af; }
.badge-draft { background: #fef3c7; color: #92400e; }
.badge-sent { background: #d1fae5; color: #065f46; }
.badge-reply { background: #e0e7ff; color: #3730a3; }
.badge-sample-accepted { background: #fce7f3; color: #9d174d; }
.badge-sample-delivered { background: #ede9fe; color: #5b21b6; }
.badge-followup { background: #fff7ed; color: #9a3412; }
.badge-followup-sent { background: #ccfbf1; color: #134e4a; }
.badge-handoff { background: #fee2e2; color: #991b1b; }
.badge-customer { background: #059669; color: white; }
.badge-rejected { background: #f3f4f6; color: #6b7280; }
.badge-dnc { background: #1f2937; color: #f9fafb; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    text-align: left;
    padding: 8px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

tr:hover td { background: #f9fafb; }

/* ---------- Forms ---------- */

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

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

textarea { min-height: 120px; resize: vertical; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

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

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #047857; }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #b45309; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }

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

.btn-sm { padding: 4px 10px; font-size: 12px; }

.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Approval Card ---------- */

.approval-card {
    background: var(--surface);
    border: 2px solid var(--warning);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.approval-card .meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 13px;
}

.approval-card .meta dt {
    font-weight: 600;
    color: var(--text-muted);
}

.approval-card .draft {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    padding: 16px;
    margin: 12px 0;
    font-family: Georgia, serif;
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
}

/* ---------- Prompt Editor ---------- */

.prompt-editor textarea {
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 13px;
    line-height: 1.6;
    min-height: 400px;
    tab-size: 2;
}

/* ---------- Thread View ---------- */

.thread-message {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.6;
}

.thread-outbound {
    background: #dbeafe;
    margin-left: 40px;
}

.thread-inbound {
    background: #f3f4f6;
    margin-right: 40px;
}

.thread-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

/* ---------- Flash Messages ---------- */

.flash {
    padding: 10px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 500;
}

.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.flash-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ---------- Empty State ---------- */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state p { font-size: 15px; margin-bottom: 16px; }

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .approval-card .meta { grid-template-columns: 1fr; }
    nav a { padding: 4px 8px; font-size: 12px; }
    header h1 { font-size: 14px; }
}
