* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: #f4f5f7;
    margin: 0;
    color: #1a1a2e;
}
.topbar {
    background: #1a1a2e;
    color: #fff;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.topbar a { color: #fff; text-decoration: none; font-size: 14px; }
.topbar .brand { font-weight: 600; font-size: 16px; }
.container {
    max-width: 1180px;
    margin: 40px auto;
    padding: 0 20px;
}
.card {
    background: #fff;
    border-radius: 10px;
    padding: 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}
.login-wrap {
    max-width: 380px;
    margin: 90px auto;
}
.login-wrap h1 {
    font-size: 20px;
    text-align: center;
    margin-bottom: 24px;
}
label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
input[type=text], input[type=email], input[type=password], select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d6d8dc;
    border-radius: 6px;
    font-size: 14px;
}
button, .btn {
    background: #2e5cff;
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    margin-top: 16px;
}
button:hover, .btn:hover { background: #1e46d6; }
.btn-secondary { background: #6b7280; }
.btn-secondary:hover { background: #52575e; }
.error {
    background: #fdecea;
    color: #b3261e;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 10px;
}
.success {
    background: #e6f4ea;
    color: #1e7e34;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 10px;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #eceef1; }
th { color: #6b7280; font-size: 12px; text-transform: uppercase; }
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-admin { background: #eee0ff; color: #6b21a8; }
.badge-agent { background: #dbeafe; color: #1d4ed8; }
.badge-viewer { background: #e5e7eb; color: #374151; }
.badge-active { background: #e6f4ea; color: #1e7e34; }
.badge-inactive { background: #f3f4f6; color: #9ca3af; }
.inline-form { display: inline; }
.actions a, .actions button { font-size: 12px; margin-top: 0; padding: 5px 10px; }
input[type=tel], textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d6d8dc;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); column-gap: 20px; }
.req { color: #b3261e; }
.muted { color: #6b7280; font-size: 13px; }
.card-header { display: flex; justify-content: space-between; align-items: center; }
.card-header h2 { margin: 0; }
.card-header .btn { margin-top: 0; }
.badge-new { background: #dbeafe; color: #1d4ed8; }
.badge-high { background: #fdecea; color: #b3261e; }
.badge-normal { background: #e5e7eb; color: #374151; }
.badge-low { background: #f3f4f6; color: #9ca3af; }
.header-actions { display: flex; gap: 8px; }
.header-actions .btn { margin-top: 0; }
.detail-table { margin-top: 16px; }
.detail-table th { width: 200px; vertical-align: top; }
.filters { margin: 16px 0 8px; display: flex; gap: 6px; }
.filters a { padding: 5px 12px; border-radius: 999px; font-size: 13px; text-decoration: none; color: #374151; background: #f3f4f6; }
.filters a.active { background: #1a1a2e; color: #fff; }
.table-wrap { overflow-x: auto; }
.row-actions { white-space: nowrap; font-size: 13px; color: #9ca3af; }
.row-actions a { color: #2e5cff; text-decoration: none; }
.row-actions a:hover { text-decoration: underline; }
.row-actions a.link-danger { color: #b3261e; }
.badge-status-unassigned { background: #fef3c7; color: #92400e; }
.badge-status-in-progress { background: #dbeafe; color: #1d4ed8; }
.badge-status-closed-success { background: #e6f4ea; color: #1e7e34; }
.badge-status-closed-no-sale { background: #fdecea; color: #b3261e; }
.badge-status-closed-invalid { background: #e5e7eb; color: #4b5563; }
.badge-status-follow-up-scheduled { background: #e0f2fe; color: #0369a1; }
.badge-danger { background: #fdecea; color: #b3261e; }
.filters { flex-wrap: wrap; }
.badge-status-awaiting-acceptance { background: #fef3c7; color: #92400e; }
.badge-status-declined { background: #fdecea; color: #b3261e; }
.badge-status-accepted-not-started { background: #ede9fe; color: #5b21b6; }
.badge-resp-pending { background: #fef3c7; color: #92400e; }
.badge-resp-accepted { background: #e6f4ea; color: #1e7e34; }
.badge-resp-declined { background: #fdecea; color: #b3261e; }
.badge-resp-withdrawn { background: #f3f4f6; color: #6b7280; }
.next-step { border-left: 4px solid #2e5cff; }
.next-step h2 { margin-top: 0; }
.action-row { display: flex; gap: 10px; align-items: center; }
.action-row form { margin: 0; }
.action-row button { margin-top: 0; }
.btn-success { background: #1e7e34; }
.btn-success:hover { background: #166128; }
.btn-danger { background: #b3261e; }
.btn-danger:hover { background: #8f1e18; }
.btn-small { margin-top: 0; padding: 4px 10px; font-size: 12px; color: #fff !important; }
.decline-form { margin-top: 18px; padding: 16px; background: #fafafa; border: 1px solid #eceef1; border-radius: 8px; max-width: 560px; }
.decline-form .error { margin-bottom: 8px; }
label.radio { font-weight: 400; margin: 6px 0; display: flex; gap: 8px; align-items: center; }
.warning { background: #fff7e6; color: #8a5300; padding: 12px 14px; border-radius: 6px; font-size: 14px; margin-bottom: 14px; }
.warning a { color: #8a5300; font-weight: 600; }
.filters .count { background: #b3261e; color: #fff; border-radius: 999px; padding: 0 7px; font-size: 11px; margin-left: 4px; }
input[type=datetime-local], input[type=date] {
    width: 100%; padding: 9px 12px; border: 1px solid #d6d8dc; border-radius: 6px; font-size: 14px; font-family: inherit;
}
.hint { color: #6b7280; font-size: 12px; margin: 6px 0 0; }
.small { font-size: 12px; }
.activity-form { background: #fafafa; border: 1px solid #eceef1; border-radius: 8px; padding: 4px 18px 18px; margin: 16px 0; }
.timeline { list-style: none; padding: 0; margin: 16px 0 0; }
.timeline li { display: flex; gap: 18px; padding: 12px 0; border-bottom: 1px solid #eceef1; }
.timeline li:last-child { border-bottom: none; }
.tl-when { width: 170px; flex-shrink: 0; font-size: 13px; color: #374151; font-weight: 600; }
.tl-title { font-size: 14px; }
.tl-notes { font-size: 14px; color: #374151; margin-top: 4px; }
.tl-meta { font-size: 12px; color: #9ca3af; margin-top: 4px; }
.late { color: #b45309; font-weight: 600; }
.effort-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin: 14px 0; }
.effort-stat { background: #f4f5f7; border-radius: 8px; padding: 12px; text-align: center; }
.effort-stat .n { font-size: 24px; font-weight: 700; }
.effort-stat .l { font-size: 12px; color: #6b7280; margin-top: 2px; }
.effort-stat.zero { opacity: 0.45; }
.effort-stat.total { background: #1a1a2e; color: #fff; }
.effort-stat.total .l { color: #cbd5e1; }
.effort-chip { display: inline-block; background: #f4f5f7; border-radius: 999px; padding: 2px 10px; font-size: 12px; margin: 2px 4px 2px 0; }
.epic-flag { background: #fff4e5; border: 1px solid #f5b85c; color: #8a4b00; padding: 12px 14px; border-radius: 8px; margin: 12px 0; font-size: 14px; }
.epic-flag form { margin-left: 8px; }
.outcome-card.outcome-flagged { border-left: 4px solid #f59e0b; }
.badge-epic { background: #fff4e5; color: #8a4b00; margin-top: 4px; }
fieldset.outcome-section { border: 1px solid #eceef1; border-radius: 8px; padding: 6px 18px 18px; margin: 18px 0 0; }
fieldset.outcome-section legend { font-weight: 600; font-size: 14px; padding: 0 6px; }
@media (max-width: 640px) {
    .timeline li { flex-direction: column; gap: 4px; }
    .tl-when { width: auto; }
    .detail-table th { width: 120px; }
}
.badge-status-sold { background: #e6f4ea; color: #1e7e34; }
.badge-status-quoted { background: #e0f2fe; color: #0369a1; }
.badge-status-not-reached { background: #fef3c7; color: #92400e; }
.badge-status-not-interested { background: #fdecea; color: #b3261e; }
.badge-status-price-rejection { background: #ffedd5; color: #9a3412; }
.badge-status-other { background: #e5e7eb; color: #4b5563; }
.badge-status-unable-to-reach { background: #fef3c7; color: #92400e; }
.badge-status-price-concern { background: #ffedd5; color: #9a3412; }
.badge-status-invalid-lead { background: #e5e7eb; color: #4b5563; }
tr.row-mine td { background: #f5f8ff; }
.nowrap { white-space: nowrap; }
.search-bar { display: flex; gap: 8px; margin: 18px 0 4px; align-items: center; }
.search-bar input[type=search] {
    flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid #d6d8dc; border-radius: 6px; font-size: 14px; font-family: inherit;
}
.search-bar button, .search-bar .btn { margin-top: 0; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
label.choice {
    display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; font-size: 14px;
    padding: 10px 14px; border: 1px solid #d6d8dc; border-radius: 8px; cursor: pointer; background: #fff;
}
label.choice:has(input:checked) { border-color: #2e5cff; background: #eef2ff; }
label.choice-sold:has(input:checked) { border-color: #1e7e34; background: #e6f4ea; }
label.choice-not-sold:has(input:checked) { border-color: #b3261e; background: #fdecea; }
/* Log out is a small form (POST) styled like the other top-bar links */
.logout-form { display: inline; margin: 0; }
button.link-button, button.link-button:hover { background: none; border: 0; padding: 0; margin: 0; color: #fff; font: inherit; font-size: 14px; cursor: pointer; }
button.link-button:hover { opacity: .85; }

/* This month's scoreboard on the dashboard */
.month-card { background: linear-gradient(135deg, #ffffff 0%, #f3f6ff 100%); }
.month-card h2 { margin: 0; }
.rank-pill { background: #2e5cff; color: #fff; border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600; }
.month-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0 12px; }
.month-stat { background: #fff; border: 1px solid #e3e7f0; border-radius: 10px; padding: 14px 16px; }
.month-stat .n { font-size: 28px; font-weight: 700; color: #1f2937; line-height: 1.1; }
.month-stat .l { font-size: 13px; color: #6b7280; margin-top: 4px; }
.month-stat.sold .n { color: #1e7e34; }
.month-stat.money .n { color: #2e5cff; font-size: 22px; }
.progress { height: 10px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, #34c759, #1e7e34); border-radius: 999px; transition: width .4s; }
.cheer { font-size: 15px; font-weight: 600; color: #1f2937; margin: 10px 0 0; }
.leaderboard-title { margin: 22px 0 8px; font-size: 16px; }
.leaderboard td:first-child { font-size: 18px; width: 40px; }
@media (max-width: 640px) {
    .month-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .month-stat .n { font-size: 22px; }
}
/* "You forgot the 10% Split in EPIC" pop-up on the Update Status page */
.funny-overlay { position: fixed; inset: 0; background: rgba(17, 24, 39, .55); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.funny-overlay[hidden] { display: none; }
.funny-box { background: #fff; border-radius: 16px; padding: 24px 28px; max-width: 380px; width: 100%; text-align: center; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); animation: pop-in .35s cubic-bezier(.2, 1.6, .5, 1); }
.funny-box h3 { margin: 8px 0 6px; font-size: 20px; }
.funny-box p { margin: 0 0 16px; color: #374151; }
.funny-face { font-size: 96px; line-height: 1; display: inline-block; animation: wobble 1s ease-in-out 2; }
@keyframes pop-in { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes wobble {
    0%, 100% { transform: rotate(0) scale(1); }
    20% { transform: rotate(-18deg) scale(1.1); }
    40% { transform: rotate(14deg) scale(1.05); }
    60% { transform: rotate(-10deg) scale(1.1); }
    80% { transform: rotate(6deg); }
}
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
label.shake { animation: shake .45s; border-color: #b3261e; background: #fdecea; }
@media (prefers-reduced-motion: reduce) { .funny-face, .funny-box, label.shake { animation: none; } }
label.epic-confirm { margin-top: 14px; display: inline-flex; }
label.epic-confirm:has(input:checked) { border-color: #1e7e34; background: #e6f4ea; }
.quick-update { max-width: 720px; }
.quick-update h2 { margin-top: 0; }
@media (max-width: 640px) {
    .search-bar { flex-wrap: wrap; }
    .card-header { flex-wrap: wrap; gap: 10px; }
}
.when-earlier { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); column-gap: 20px; max-width: 560px; }
.when-earlier[hidden] { display: none; }
.time-selects { display: flex; align-items: center; gap: 6px; }
.time-selects select { width: auto; min-width: 70px; }
