/* public/css/salespeople-goals.css
   The Sales tab's switch and its Goal tracker (the salesperson view lane,
   piece 3 Part C; public/js/tabs/salespeople-goals.js). The app's own tokens
   from dashboard.css and nothing else, and every selector names the view's
   own class or id; tests/salespeople-goals-view.test.js pins both. The phone
   layout sits in one block at the platform's mobile breakpoint, 1024px
   (docs/design/mobile-design-system.md section 1.2): there each row is a card
   and no table scrolls sideways (ruling 11). */

/* The switch, Overview | Goal tracker */
#sales-view-tabs.spg-switch{justify-content:flex-end;margin-bottom:var(--sp-4);}
#sales-view-tabs .tab{font-family:var(--font-head);}

/* The head: the window, its caption and the two controls */
.spg-head{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--sp-4);flex-wrap:wrap;margin-bottom:var(--sp-4);}
.spg-title{font-family:var(--font-head);font-size:16px;font-weight:700;color:var(--text);}
.spg-caption{font-size:12px;color:var(--dim);margin-top:var(--sp-1);line-height:1.5;}
.spg-controls{display:flex;gap:var(--sp-2);flex-wrap:wrap;}
.spg-seg{display:inline-flex;border:1px solid var(--border2);border-radius:var(--r-sm);overflow:hidden;}
.spg-seg button{background:transparent;border:none;color:var(--muted);font-family:var(--font-head);font-size:11px;font-weight:700;letter-spacing:1px;text-transform:uppercase;white-space:nowrap;padding:6px 12px;min-height:32px;cursor:pointer;transition:all .15s;}
.spg-seg button + button{border-left:1px solid var(--border2);}
.spg-seg button.active{background:var(--accent-dim);color:var(--accent);}
.spg-seg button.spg-off:hover{color:var(--text2);}

/* The strip, super_admin only */
.spg-strip{display:flex;align-items:center;justify-content:space-between;gap:var(--sp-3);flex-wrap:wrap;background:var(--amber-dim);border-left:3px solid var(--amber);border-radius:var(--r-sm);color:var(--amber);font-size:12px;line-height:1.5;padding:10px 14px;margin-bottom:var(--sp-4);}
.spg-link{background:none;border:none;padding:0;color:var(--accent);font-family:var(--font-body);font-size:12px;font-weight:600;text-decoration:underline;cursor:pointer;}
.spg-link:hover{color:var(--accent2);}

/* The table's card */
.spg-tablehead{display:flex;align-items:center;justify-content:space-between;gap:var(--sp-3);flex-wrap:wrap;margin-bottom:var(--sp-4);padding-bottom:var(--sp-3);border-bottom:1px solid var(--border);}
.spg-what{flex:1 1 360px;font-size:12px;color:var(--muted);line-height:1.5;}
.spg-what strong{color:var(--text2);}
.spg-actions{display:flex;align-items:center;gap:var(--sp-2);flex-wrap:wrap;}
.spg-scroll{overflow-x:auto;}
.spg-empty,.spg-msg{color:var(--dim);font-size:13px;line-height:1.6;padding:var(--sp-5) 0;text-align:center;}

/* A row */
.spg-table td{vertical-align:middle;}
.spg-table .spg-c-name{text-align:left;white-space:normal;min-width:180px;}
.spg-name{background:none;border:none;padding:0;color:var(--text);font-family:var(--font-body);font-size:13px;font-weight:600;text-align:left;cursor:pointer;}
.spg-name:hover{color:var(--accent);text-decoration:underline;}
.spg-name-text{color:var(--text);font-weight:600;}
.spg-entry{margin-left:var(--sp-1);font-family:var(--font-mono);font-size:10px;font-weight:500;letter-spacing:0.5px;color:var(--dim);white-space:nowrap;}
.spg-note{margin-top:2px;font-family:var(--font-body);font-size:11px;font-weight:400;color:var(--dim);line-height:1.4;}
.spg-big{font-size:15px;font-weight:700;color:var(--text);}
.spg-trend{font-size:12px;font-weight:600;white-space:nowrap;}
.spg-up{color:var(--green);}
.spg-down{color:var(--red);}
.spg-same{color:var(--muted);}
.spg-new{color:var(--accent);}
.spg-sub{margin-top:2px;font-family:var(--font-body);font-size:10px;color:var(--dim);white-space:nowrap;}
.spg-table .spg-c-bar{width:24%;min-width:200px;}
.spg-bar{position:relative;height:8px;background:var(--card2);border-radius:4px;}
.spg-fill{position:absolute;left:0;top:0;bottom:0;border-radius:4px;}
.spg-fill.spg-green{background:var(--green);}
.spg-fill.spg-amber{background:var(--amber);}
.spg-fill.spg-red{background:var(--red);}
.spg-mark{position:absolute;top:-3px;bottom:-3px;width:2px;margin-left:-1px;background:var(--muted);}
.spg-marks{position:relative;height:14px;margin-top:3px;font-family:var(--font-mono);font-size:9px;color:var(--dim);}
/* The minimum's label ends at its mark and the goal's starts at its own, so
   the two never run together however short the bar. */
.spg-marks span{position:absolute;white-space:nowrap;}
.spg-marks .spg-mk-min{transform:translateX(-100%);padding-right:3px;}
.spg-marks .spg-mk-goal{padding-left:3px;}
.spg-table .spg-c-status{text-align:left;white-space:nowrap;}
/* The statuses are sentences (ruling 7): the app's badge, in sentence case. */
.spg-table .badge{text-transform:none;letter-spacing:0.3px;}
.spg-quiet{background:var(--card2);color:var(--muted);}
.spg-muted .spg-name,.spg-muted .spg-name-text,.spg-muted .spg-big{color:var(--muted);}
.spg-table th:not(.num){text-align:left;}
.spg-tag{display:inline-block;white-space:nowrap;padding:2px 6px;border-radius:4px;background:var(--card2);font-family:var(--font-mono);font-size:10px;color:var(--muted);}

/* A store's section */
.spg-store-head td{padding:10px 12px;text-align:left;background:var(--surface);border-bottom:1px solid var(--border2);}
.spg-store-btn{margin-right:var(--sp-3);padding:0;background:none;border:none;color:var(--text);font-family:var(--font-head);font-size:12px;font-weight:800;letter-spacing:1px;text-transform:uppercase;cursor:pointer;}
.spg-caret{display:inline-block;width:14px;color:var(--muted);}
.spg-store-sum{font-family:var(--font-body);font-size:11px;font-weight:400;color:var(--dim);}
.spg-chips{float:right;display:inline-flex;gap:var(--sp-1);flex-wrap:wrap;}
.spg-subhead td{padding:8px 12px 4px;text-align:left;font-family:var(--font-head);font-size:9px;font-weight:700;letter-spacing:1.5px;text-transform:uppercase;color:var(--dim);}

/* The drill, in the shared drill overlay */
.spg-drill-eyebrow{margin-bottom:2px;font-family:var(--font-head);font-size:10px;font-weight:700;letter-spacing:1.5px;text-transform:uppercase;color:var(--dim);}
.spg-drill-name{font-size:17px;font-weight:700;color:var(--text);}
.spg-drill-sub{margin-top:2px;font-size:12px;font-weight:400;letter-spacing:0;color:var(--muted);}
.spg-kv{display:block;white-space:normal;font-size:18px;line-height:1.25;}
.spg-kv.spg-green{color:var(--green);}
.spg-kv.spg-amber{color:var(--amber);}
.spg-kv.spg-red{color:var(--red);}
#drill-table .spg-dhead th:not(.num),#drill-table .spg-dbody td:not(.num){text-align:left;}
#drill-table .spg-how{font-family:var(--font-body);}
#drill-table .spg-flag{color:var(--amber);}
#drill-table .spg-dtotal td{font-weight:700;color:var(--text);border-top:1px solid var(--border2);}
#drill-table .spg-dnote td{white-space:normal;text-align:left;font-family:var(--font-body);font-size:12px;font-weight:400;line-height:1.6;color:var(--muted);}
#drill-table .spg-dempty td{white-space:normal;text-align:center;color:var(--dim);}

/* The phone: the rows are cards */
@media (max-width: 1024px){
  #sales-view-tabs .tab{flex:1 1 0;text-align:center;}
  .spg-head{flex-direction:column;}
  .spg-controls{width:100%;}
  /* Each control group a row of its own, whatever width an engine gives the
     group's content, so no label is squeezed (Part D fix 4). */
  .spg-seg{flex:1 1 100%;}
  .spg-seg button{flex:1 1 0;min-height:40px;}
  .spg-scroll{overflow-x:visible;}
  .spg-table,.spg-table tbody{display:block;}
  .spg-table thead{display:none;}
  .spg-table tr{display:block;}
  .spg-table tr.spg-line{display:flex;flex-wrap:wrap;align-items:baseline;gap:6px 12px;margin-bottom:var(--sp-2);padding:12px 14px;background:var(--surface);border:1px solid var(--border);border-radius:var(--r-md);}
  .spg-table tr.spg-line td{display:block;min-width:0;padding:0;border:none;background:none;text-align:left;white-space:normal;}
  /* Row one: the rank, the name, the store tag and the sales figure, the name
     taking what the others leave. Then a break of no height and full width,
     so the units always open row two, the change at its right; then the bar
     and the status (Part D fix 2). */
  .spg-table .spg-c-rank{order:0;width:auto;}
  .spg-table .spg-c-name{order:1;flex:1 1 0;min-width:0;}
  .spg-table .spg-c-store{order:2;}
  .spg-table .spg-c-sales{order:3;}
  .spg-table .spg-c-sales .spg-big{font-size:24px;}
  .spg-table .spg-c-sales::after{content:' sales';font-size:12px;font-weight:400;color:var(--muted);}
  .spg-table .spg-c-sales.spg-one::after{content:' sale';}
  .spg-table tr.spg-line::after{content:'';order:4;flex:0 0 100%;height:0;}
  .spg-table .spg-c-units{order:5;color:var(--muted);}
  .spg-table .spg-c-units::after{content:' units';}
  .spg-table .spg-c-units.spg-one::after{content:' unit';}
  .spg-table .spg-c-trend{order:6;margin-left:auto;text-align:right;}
  .spg-table .spg-c-trend:empty,.spg-table .spg-c-bar:empty{display:none;}
  .spg-table .spg-c-bar{order:7;flex:1 1 100%;min-width:0;}
  .spg-table .spg-c-status{order:8;flex:1 1 100%;white-space:normal;}
  .spg-table .spg-store-head td{display:block;padding:12px 2px 8px;background:none;border:none;}
  .spg-chips{float:none;display:flex;margin-top:var(--sp-2);}
  .spg-table .spg-subhead td{display:block;padding:8px 2px 6px;}
  .tbl-wrap table:has(.spg-dbody){min-width:0;}
  #drill-table .spg-dhead{display:none;}
  #drill-table .spg-dbody,#drill-table .spg-dfoot{display:block;}
  #drill-table .spg-dbody tr,#drill-table .spg-dfoot tr{display:flex;flex-wrap:wrap;gap:4px 10px;padding:10px 0;border-bottom:1px solid var(--border);}
  #drill-table .spg-dbody td,#drill-table .spg-dfoot td{display:block;position:static;padding:0;border:none;background:none;text-align:left;white-space:normal;}
  #drill-table .spg-dbody td:nth-child(3){order:3;flex:1 1 100%;color:var(--text);}
  #drill-table .spg-dbody td:nth-child(5){order:4;flex:1 1 100%;}
  #drill-table .spg-dbody td:nth-child(6){order:5;}
  #drill-table .spg-dbody td:nth-child(7){order:6;}
  #drill-table .spg-dbody td:nth-child(6)::before,#drill-table .spg-dtotal td:nth-child(2)::before{content:'Sales ';font-weight:400;color:var(--dim);}
  #drill-table .spg-dbody td:nth-child(7)::before,#drill-table .spg-dtotal td:nth-child(3)::before{content:'Units ';font-weight:400;color:var(--dim);}
  #drill-table .spg-dempty td{flex:1 1 100%;text-align:center;}
}
