/* SCC CRM – small additions on top of Pico */
:root { --pico-font-size: 95%; --scc-accent: #b4532a; /* copper */ }
/* Same selectors Pico uses for its light theme, so these win. */
[data-theme=light], :root:not([data-theme=dark]) {
  --pico-text-selection-color: rgba(180, 83, 42, .25);
  --pico-primary-focus: rgba(180, 83, 42, .35);
  --pico-primary-underline: rgba(180, 83, 42, .5);
  --pico-primary: var(--scc-accent);
  --pico-primary-background: var(--scc-accent);
  --pico-primary-border: var(--scc-accent);
  --pico-primary-hover: #8f3f1f;
  --pico-primary-hover-background: #8f3f1f;
  --pico-primary-hover-border: #8f3f1f;
}
body > header.app { border-bottom: 1px solid var(--pico-muted-border-color); margin-bottom: 1.25rem; }
body > header.app nav { padding: 0 1rem; }
header.app .brand { font-weight: 700; color: #1f2937; text-decoration: none; }
header.app .brand span { color: var(--scc-accent); }
header.app nav ul li a[aria-current="page"] { color: var(--scc-accent); font-weight: 600; }
main.container { padding-top: 0; }

.flash { padding: .75rem 1rem; border-radius: var(--pico-border-radius); margin-bottom: 1rem;
         border-left: 4px solid; word-break: break-word; }
.flash.success { background: #ecfdf5; border-color: #059669; color: #065f46; }
.flash.warning { background: #fffbeb; border-color: #d97706; color: #92400e; }
.flash.error   { background: #fef2f2; border-color: #dc2626; color: #991b1b; }
.flash.info    { background: #eff6ff; border-color: #2563eb; color: #1e40af; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stats article { margin: 0; padding: 1rem; }
.stats .value { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.stats .label { color: var(--pico-muted-color); font-size: .85rem; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.page-head h1, .page-head h2 { margin-bottom: .5rem; }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: .75rem; }
@media (max-width: 720px) { .filters { grid-template-columns: 1fr 1fr; } }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem;
         background: var(--pico-muted-border-color); }
.badge.inactive { background: #fee2e2; color: #991b1b; }
.badge.role-admin { background: #ede9fe; color: #5b21b6; }
.badge.role-manager { background: #dbeafe; color: #1e40af; }
.badge.role-executive { background: #fef3c7; color: #92400e; }
.field-error { color: #b91c1c; font-size: .85rem; margin-top: -.5rem; display: block; }
.muted { color: var(--pico-muted-color); }
table td, table th { vertical-align: middle; }
.auth-card { max-width: 420px; margin: 3rem auto; }
.danger { --pico-background-color: #b91c1c; --pico-border-color: #b91c1c; }
.inline-form { display: inline; }
.inline-form button { width: auto; }

/* Phase 3 */
.pager { display: flex; gap: 1rem; align-items: center; justify-content: flex-end; margin: 1rem 0; }
.pager a[role=button] { padding: .35rem .8rem; margin: 0; }
a.sort { color: inherit; text-decoration: none; white-space: nowrap; }
a.sort.active { color: var(--scc-accent); }
.filters-wide { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem; }
.filters-wide input, .filters-wide select { margin-bottom: .25rem; }
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
dl.facts dt { color: var(--pico-muted-color); font-weight: normal; }
dl.facts dd { margin: 0; }
section.card { border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius);
               padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
section.card > h3, section.card > header h3 { font-size: 1.05rem; margin-bottom: .75rem; }
section.card header { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: .5rem 0; border-bottom: 1px solid var(--pico-muted-border-color); list-style: none; }
.timeline li:last-child { border-bottom: none; }
.small { font-size: .85rem; }
.btn-sm { padding: .3rem .7rem; font-size: .85rem; width: auto; margin: 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.dup-panel { border: 2px solid #d97706; background: #fffbeb; border-radius: var(--pico-border-radius);
             padding: .75rem 1rem; margin-bottom: 1rem; }
.dup-panel ul { margin-bottom: .5rem; }
.status-pill { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .75rem;
               background: #e5e7eb; }
.status-pill.active, .status-pill.completed, .status-pill.won { background: #d1fae5; color: #065f46; }
.status-pill.prospect, .status-pill.scheduled { background: #e0e7ff; color: #3730a3; }
.status-pill.confirmed { background: #fef3c7; color: #92400e; }
.status-pill.inactive, .status-pill.cancelled, .status-pill.no_show, .status-pill.lost { background: #fee2e2; color: #991b1b; }
.lookup-results { border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius);
                  max-height: 260px; overflow-y: auto; margin-top: -.5rem; margin-bottom: 1rem; }
.lookup-results button { display: block; width: 100%; text-align: left; border: 0; border-radius: 0;
                         background: transparent; color: inherit; padding: .5rem .75rem; margin: 0; }
.lookup-results button:hover { background: #f3f4f6; }
.lookup-results .no-access { color: var(--pico-muted-color); padding: .5rem .75rem; }

/* Pipeline board */
main.container:has(.board) { max-width: none; padding: 0 1rem; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: .75rem;
         overflow-x: auto; padding-bottom: 1rem; margin-top: .5rem; }
.board-col { background: #f8fafc; border-radius: var(--pico-border-radius); padding: .5rem;
             border-top: 4px solid var(--stage-color); min-height: 60vh; }
.board-col.drop-target { outline: 2px dashed var(--scc-accent); background: #fff7ed; }
.board-col > header { display: flex; flex-direction: column; padding: .25rem .25rem .5rem; }
.board-cards { display: flex; flex-direction: column; gap: .5rem; }
.deal-card { margin: 0; padding: .6rem .7rem; background: #fff; border: 1px solid #e5e7eb;
             border-radius: 6px; box-shadow: none; font-size: .85rem; }
.deal-card[draggable=true] { cursor: grab; }
.deal-card.mine { border-left: 3px solid var(--scc-accent); }
.deal-card.dragging { opacity: .4; }
.deal-card .deal-account { font-weight: 600; text-decoration: none; display: block; line-height: 1.25; }
.deal-card .deal-meta { display: flex; justify-content: space-between; gap: .5rem; margin-top: .25rem; }
#stage-dialog article { max-width: 480px; }
#stage-dialog footer { display: flex; gap: .5rem; justify-content: flex-end; }
#stage-dialog footer button, #stage-dialog footer [role=button] { width: auto; margin: 0; }

/* Phase 4: tastings */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
.photo-grid figure { margin: 0; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.recap { max-width: 560px; margin: 0 auto; }
.recap input, .recap textarea { font-size: 1.05rem; }
.recap button[type=submit] { width: 100%; padding: .9rem; font-size: 1.1rem; margin-top: .5rem; }

/* Calendar */
.cal-nav { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; margin: .5rem 0 .75rem; }
.cal-title { font-size: 1.15rem; margin-left: .5rem; }
.legend { display: flex; gap: .4rem; flex-wrap: wrap; }
.legend .ev { padding: .1rem .5rem; border-radius: 4px; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid #e5e7eb; border-top: 1px solid #e5e7eb; }
.cal-dow { padding: .3rem .4rem; font-size: .8rem; color: var(--pico-muted-color); border-right: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; background: #f8fafc; }
.cal-day { min-height: 112px; padding: .25rem; border-right: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.cal-day.other { background: #fafafa; }
.cal-day.other .cal-date { color: #9ca3af; }
.cal-day.today { background: #fff7ed; }
.cal-date { font-size: .8rem; font-weight: 600; text-decoration: none; color: inherit; }
.ev { display: block; font-size: .75rem; line-height: 1.3; padding: 1px 4px; border-radius: 3px; text-decoration: none;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid; }
.ev .t { font-weight: 600; }
.ev.scheduled, .ev-card.scheduled { background: #e0e7ff; color: #3730a3; border-color: #6366f1; }
.ev.confirmed, .ev-card.confirmed { background: #fef3c7; color: #92400e; border-color: #f59e0b; }
.ev.completed, .ev-card.completed { background: #d1fae5; color: #065f46; border-color: #10b981; }
.ev.needs-recap, .ev-card.needs-recap { background: #fee2e2; color: #991b1b; border-color: #ef4444; }
.ev.cancelled, .ev-card.cancelled { background: #f3f4f6; color: #6b7280; border-color: #9ca3af; text-decoration: line-through; }
.cal-day .more { color: var(--pico-muted-color); }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; }
.cal-col { background: #f8fafc; border-radius: 6px; padding: .4rem; min-height: 50vh; }
.cal-col.today { background: #fff7ed; }
.cal-col-head { padding: .2rem .2rem .5rem; font-size: .9rem; }
.ev-card { display: flex; flex-direction: column; gap: 1px; padding: .4rem .5rem; margin-bottom: .4rem; border-radius: 5px;
           border-left: 3px solid; text-decoration: none; font-size: .85rem; }
@media (max-width: 800px) {
  .cal-month { font-size: .7rem; }
  .cal-day { min-height: 70px; }
  .ev .t { display: none; }
  .cal-week { grid-template-columns: 1fr; }
  .cal-col { min-height: auto; }
}

/* Narrow screens: let the top menu wrap instead of widening the page */
@media (max-width: 760px) {
  body > header.app nav { flex-wrap: wrap; padding: 0 .5rem; }
  body > header.app nav ul { flex-wrap: wrap; margin: 0; }
  body > header.app nav ul:first-child { width: 100%; }
  body > header.app nav li { padding: .35rem .45rem; }
  body > header.app nav details.dropdown summary { padding: .25rem .5rem; height: auto; }
  main.container { padding-left: .75rem; padding-right: .75rem; }
  .filters-wide { grid-template-columns: 1fr 1fr; }
}

/* Phase 5 */
.bell { position: relative; display: inline-flex; align-items: center; color: inherit; }
.bell-count { position: absolute; top: -6px; right: -10px; background: #dc2626; color: #fff; font-size: .65rem;
              font-weight: 700; border-radius: 999px; padding: 0 .35rem; line-height: 1.3rem; min-width: 1.3rem; text-align: center; }
.quick-log { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: 1rem; }
.quick-log .wide { grid-column: 1 / -1; }
.quick-log input, .quick-log select, .quick-log textarea { margin-bottom: 0; }
@media (max-width: 600px) { .quick-log { grid-template-columns: 1fr; } }
.task-row { display: flex; gap: .6rem; align-items: flex-start; padding: .5rem 0; border-bottom: 1px solid var(--pico-muted-border-color); }
.task-row:last-child { border-bottom: none; }
.task-row form { margin: 0; }
.task-row input[type=checkbox] { margin-top: .25rem; }
.task-row .task-main { flex: 1; }
.task-row.done .task-title { text-decoration: line-through; color: var(--pico-muted-color); }
.due.overdue { color: #b91c1c; font-weight: 600; }
.due.today { color: #b45309; font-weight: 600; }
.myday-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 1.25rem; }
@media (max-width: 900px) { .myday-grid { grid-template-columns: 1fr; } }
.meter { height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; margin: .25rem 0 .75rem; }
.meter > span { display: block; height: 100%; background: var(--scc-accent); }
.meter > span.done { background: #059669; }
.notif { display: flex; gap: .75rem; padding: .6rem .25rem; border-bottom: 1px solid var(--pico-muted-border-color); align-items: flex-start; }
.notif.unread { background: #fff7ed; }
.notif form { margin: 0; flex: 1; }
.notif button.linklike { all: unset; cursor: pointer; display: block; width: 100%; }
.notif button.linklike:hover strong { color: var(--scc-accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--scc-accent); margin-top: .45rem; flex: none; }
.dot.read { background: transparent; }

/* Phase 6 */
.meter.thin { height: 4px; margin: .2rem 0 0; }
table.dash td, table.dash th { white-space: nowrap; }
.ok { color: #047857; } .warn { color: #b45309; } .bad { color: #b91c1c; font-weight: 600; }
.leaderboard tr.me td { background: #fff7ed; }
.leaderboard .rank { width: 3rem; }
.medal { display: inline-block; width: 1.6rem; height: 1.6rem; border-radius: 50%; text-align: center; line-height: 1.6rem;
         font-weight: 700; font-size: .85rem; color: #fff; }
.medal.m1 { background: #d4a017; } .medal.m2 { background: #9ca3af; } .medal.m3 { background: #b4632a; }
.quota-grid input { margin: 0; min-width: 6rem; }

/* Reports */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.report-tile { display: flex; flex-direction: column; gap: .35rem; padding: 1rem 1.1rem; border: 1px solid var(--pico-muted-border-color);
               border-radius: var(--pico-border-radius); text-decoration: none; color: inherit; }
.report-tile:hover { border-color: var(--scc-accent); }
.chart-wrap svg.chart { width: 100%; max-width: 760px; height: auto; display: block; }
.report-table th.num, .report-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Import */
.stat-row { margin-bottom: 1rem; }
.stat-row .stat { display: flex; flex-direction: column; gap: .2rem; margin: 0; padding: 1rem 1.1rem; }
.stat-value { font-size: 1.75rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-label { color: var(--pico-muted-color); font-size: .875rem; }
