/* Falcon standard screen layout (PLM and CRM): one set of styles for boxes, box headings, figure boxes, tables, filter
   bars, the Filters panel, tabs and phone cards, matching the tidied Admin Console. Every rule needs body.std-screens,
   which web/src/shell.ts sets on every organisation screen except OWN_LAYOUT (the Time & Action Plan, the QC inspection
   steps and printable documents keep their own layout). Sizes follow the shared type scale in tokens.css. Nothing is
   hidden or removed here. */

/* ---- Page rhythm ---- */
body.std-screens #content{padding:16px 20px 28px!important}
body.std-screens #content .dash{gap:14px!important}

/* ---- Boxes: thin line, 10px corners, no shadow; heading strip 10px 14px with a line under it ---- */
body.std-screens #content .panel,body.std-screens #content .falcon-admin-section{border:1px solid var(--line,#e5e7eb)!important;border-radius:10px!important;box-shadow:none!important;background:var(--panel,#fff)!important}
body.std-screens #content .panel{padding:12px 14px!important}
body.std-screens #content .panel>.panel-head{display:flex!important;align-items:center!important;gap:10px!important;margin:-12px -14px 12px!important;padding:10px 14px!important;border-bottom:1px solid var(--line,#e5e7eb)!important;background:transparent!important;min-height:0!important}
body.std-screens #content .panel>.panel-head h3,body.std-screens #content .falcon-admin-section-head h3{margin:0!important;font-size:var(--fs-heading)!important;font-weight:var(--fw-heading)!important;line-height:1.35!important}
body.std-screens #content .panel>.panel-head .muted,body.std-screens #content .falcon-admin-section-head span{display:block;font-size:var(--fs-label)!important;color:var(--fg-secondary)!important;line-height:1.4!important}
body.std-screens #content .panel>.panel-head>:last-child:not(:first-child){margin-left:auto}
body.std-screens #content .falcon-admin-section{overflow:hidden}
body.std-screens #content .falcon-admin-section-head{display:flex!important;align-items:center!important;gap:10px!important;padding:10px 14px!important;background:transparent!important;border-bottom:1px solid var(--line,#e5e7eb)!important}
body.std-screens #content .panel .empty{padding:16px 0!important;color:var(--fg-secondary)!important;font-size:var(--fs-label)!important}
/* Small boxes inside a box (Items needing attention, Production route) */
body.std-screens #content .po-attention,body.std-screens #content .stp-panel{border:1px solid var(--line,#e5e7eb)!important;border-radius:8px!important;background:#fff!important;box-shadow:none!important;padding:10px 14px!important;margin-top:12px!important}
body.std-screens #content .po-attention>h4,body.std-screens #content .stp-panel>h4,body.std-screens #content .dash-tools-sub h4{font-size:var(--fs-heading)!important;font-weight:var(--fw-heading)!important;margin:0 0 8px!important}

/* ---- Buttons: 32px; small buttons 28px ---- */
body.std-screens #content a.primary,body.std-screens #content a.secondary,body.std-screens #content button.primary,body.std-screens #content button.secondary{display:inline-flex;align-items:center;justify-content:center;gap:6px;height:var(--ctl-h)!important;min-height:var(--ctl-h)!important;padding:0 12px!important;border-radius:6px!important;box-shadow:none!important;font-weight:500!important;line-height:1!important;white-space:nowrap;box-sizing:border-box!important}
body.std-screens #content :is(a,button,.badge)[hidden]{display:none!important}
body.std-screens #content :is(a,button).small-btn{height:28px!important;min-height:28px!important;padding:0 10px!important;font-size:var(--fs-label)!important}
body.std-screens #content .tp-banner-actions{flex-wrap:wrap;max-width:100%}

/* ---- Figure boxes (PO totals, Payments, task / QC / Tech Pack / certificate counts, CRM figures, claims): label 12px grey,
   figure 20px, note 12px grey ---- */
body.std-screens #content :is(.po-summary-bar,.fin-kpis,.falcon-platform-kpis,.crm-kpis,.crm-rep-tiles,.cl-tiles){display:grid!important;grid-template-columns:repeat(auto-fit,minmax(160px,1fr))!important;gap:10px!important}
body.std-screens #content :is(.po-summary-bar,.fin-kpis,.falcon-platform-kpis,.crm-kpis,.crm-rep-tiles,.cl-tiles)>*{display:flex!important;flex-direction:column!important;gap:2px!important;min-width:0!important;min-height:0!important;padding:10px 12px!important;border:1px solid var(--line,#e5e7eb)!important;border-radius:10px!important;background:var(--panel,#fff)!important;box-shadow:none!important;color:inherit!important;text-decoration:none!important}
body.std-screens #content :is(.po-summary-bar,.fin-kpis,.falcon-platform-kpis,.crm-kpis,.crm-rep-tiles,.cl-tiles)>*>span:first-child{font-size:var(--fs-label)!important;font-weight:400!important;text-transform:none!important;letter-spacing:0!important;color:var(--fg-secondary)!important}
body.std-screens #content :is(.po-summary-bar,.fin-kpis,.falcon-platform-kpis,.crm-kpis,.crm-rep-tiles,.cl-tiles)>*>strong:not(#_){font-size:20px!important;font-weight:600!important;line-height:1.25!important;color:var(--fg,#111827)!important}
body.std-screens #content :is(.po-summary-bar,.fin-kpis,.falcon-platform-kpis,.crm-kpis,.crm-rep-tiles,.cl-tiles)>*>strong span{font-size:inherit!important;font-weight:inherit!important;color:inherit!important}
body.std-screens #content :is(.po-summary-bar,.fin-kpis,.falcon-platform-kpis,.crm-kpis,.crm-rep-tiles,.cl-tiles)>*>:is(small,em){font-size:var(--fs-label)!important;color:var(--fg-secondary)!important;font-style:normal;text-transform:none!important}
body.std-screens #content :is(.po-summary-bar,.fin-kpis,.falcon-platform-kpis,.crm-kpis,.crm-rep-tiles,.cl-tiles)>a:hover{border-color:#1d4ed8!important}
body.std-screens #content .falcon-platform-kpis>.warn{border-color:#fde68a!important;background:#fffbeb!important}
body.std-screens #content .falcon-platform-kpis>:is(.bad,.is-bad){border-color:#fecaca!important;background:#fef2f2!important}
body.std-screens #content .falcon-table-summary{margin:12px 0!important}

/* ---- Dashboard: pipeline stages, health list, clocks ---- */
body.std-screens #content .dash-stages a{padding:10px 8px!important;gap:2px!important}
body.std-screens #content .dash-stages span{font-size:var(--fs-label)!important;font-weight:500!important}
body.std-screens #content .dash-stages strong{font-size:20px!important;font-weight:600!important}
body.std-screens #content .dash-health-list li{min-height:30px;padding:4px 0!important;font-size:var(--fs-field)!important}
body.std-screens #content .falcon-action-list>*{border-radius:8px!important;box-shadow:none!important}
body.std-screens #content .dash-dates table td a{text-decoration:none!important}
body.std-screens #content .activity-item{padding:8px 14px!important;align-items:center!important}
body.std-screens #content .activity-user{font-weight:500!important}
body.std-screens #content .activity-time{color:var(--fg-secondary)!important;font-size:var(--fs-label)!important}

/* ---- Filter bar: one line (search grows; dropdowns, saved filters and buttons beside it) ---- */
body.std-screens #content .master-filterbar{display:flex!important;flex-wrap:wrap!important;align-items:center!important;gap:8px!important;margin:-12px -14px 0!important;padding:10px 14px!important;background:#f9fafb!important;border:0!important;border-bottom:1px solid var(--line,#e5e7eb)!important}
body.std-screens #content .panel>.panel-head+.master-filterbar{margin-top:-12px!important}
body.std-screens #content .master-filterbar input[type=search]{flex:1 1 200px!important;min-width:180px!important;max-width:none!important;width:auto!important}
body.std-screens #content .std-filter-wrap .cp-filter-btn{height:var(--ctl-h)!important;min-height:var(--ctl-h)!important;font-size:var(--fs-field)!important;padding:0 12px!important}
body.std-screens #content .std-filter-wrap .cp-filter-n[hidden]{display:none!important}
body.std-screens #content .std-filter-pop{width:340px;max-width:calc(100vw - 32px)}
body.std-screens #content .std-fp-fields{display:grid;gap:10px;padding-top:10px!important;padding-bottom:12px!important}
body.std-screens #content .std-fp-field{display:flex;flex-direction:column;gap:3px;margin:0}
body.std-screens #content .std-fp-field>span{font-size:var(--fs-label)!important;color:var(--fg-secondary)!important;font-weight:500}
body.std-screens #content .std-fp-field>select{flex:none!important;width:100%!important;max-width:none!important;height:var(--ctl-h)!important;min-height:var(--ctl-h)!important;box-sizing:border-box}
body.std-screens #content .master-filterbar .falcon-table-tools{display:flex!important;flex-wrap:nowrap!important;align-items:center;gap:6px!important;margin:0 0 0 auto!important;flex:0 0 auto!important;width:auto!important;max-width:none!important}
body.std-screens #content .master-filterbar .falcon-table-tools select{width:140px!important;flex:0 0 140px!important}
body.std-screens #content .master-filterbar .falcon-table-tools .small-btn{height:var(--ctl-h)!important;min-height:var(--ctl-h)!important;font-size:var(--fs-field)!important}

/* ---- Tables: grey heading row, plain-case 12px headings, comfortable rows ---- */
body.std-screens #content .table-wrap{border:1px solid var(--line,#e5e7eb)!important;border-radius:8px!important;box-shadow:none!important}
body.std-screens #content table th{font-size:var(--fs-label)!important;font-weight:500!important;text-transform:none!important;letter-spacing:0!important;color:var(--fg-secondary)!important;background:#f9fafb!important;padding:7px 8px!important}
body.std-screens #content table td{padding:7px 8px!important;vertical-align:middle!important}
body.std-screens #content table.falcon-table tbody tr:hover td{background:#f8fafc}
body.std-screens #content table td a:not(.primary):not(.secondary):not(.small-btn){text-decoration:none!important;font-weight:500}
body.std-screens #content table td a:not(.primary):not(.secondary):not(.small-btn):hover{text-decoration:underline!important}
body.std-screens #content .falcon-table-totals td{background:#f9fafb!important;font-weight:600}
body.std-screens #content .falcon-table-foot{font-size:var(--fs-label)!important;color:var(--fg-secondary)!important}
body.std-screens #content .badge{display:inline-flex;align-items:center;height:22px;padding:0 9px!important;border-radius:999px!important;font-size:var(--fs-label)!important;font-weight:500!important;text-transform:none!important;letter-spacing:0!important}

/* ---- One PO: header box, facts, tabs ---- */
body.std-screens #content .falcon-po-summary h3{font-size:16px!important;font-weight:600!important;margin:2px 0 6px!important}
body.std-screens #content .falcon-item-type{font-size:var(--fs-label)!important;font-weight:500!important;text-transform:none!important;letter-spacing:0!important;color:var(--fg-secondary)!important}
body.std-screens #content .falcon-po-facts{gap:10px 16px!important}
body.std-screens #content .falcon-po-facts dt{font-size:var(--fs-label)!important;font-weight:400!important;text-transform:none!important;letter-spacing:0!important;color:var(--fg-secondary)!important}
body.std-screens #content .falcon-po-facts dd{font-size:var(--fs-field)!important;font-weight:500!important}
body.std-screens #content .falcon-po-actions{gap:8px!important}
body.std-screens #content .fin-po-head{border:1px solid var(--line,#e5e7eb)!important;border-radius:10px!important;background:#f9fafb!important;padding:8px 14px!important}
body.std-screens #content .fin-po-head .muted{text-transform:none!important;letter-spacing:0!important}
body.std-screens #content .falcon-tabs{border-bottom:1px solid var(--line,#e5e7eb)!important;gap:2px!important}
body.std-screens #content .falcon-tab{text-decoration:none!important;font-size:var(--fs-field)!important;font-weight:500!important;color:var(--fg-secondary)!important;padding:9px 12px!important}
body.std-screens #content .falcon-tab.active{color:#1d4ed8!important;box-shadow:inset 0 -2px 0 #1d4ed8!important}
body.std-screens #content .falcon-tab-body{border-top:0!important;border-radius:0 0 10px 10px!important}
body.std-screens #content .falcon-back-btn{height:var(--ctl-h)!important}

/* ---- Dark theme ---- */
body.dark-theme.std-screens #content .panel,body.dark-theme.std-screens #content .falcon-admin-section,body.dark-theme.std-screens #content :is(.po-summary-bar,.fin-kpis,.falcon-platform-kpis,.crm-kpis,.crm-rep-tiles,.cl-tiles)>*,body.dark-theme.std-screens #content .po-attention,body.dark-theme.std-screens #content .stp-panel{background:var(--dk-panel,#172033)!important;border-color:var(--dk-line,#334155)!important}
body.dark-theme.std-screens #content table th,body.dark-theme.std-screens #content .master-filterbar,body.dark-theme.std-screens #content .falcon-table-totals td,body.dark-theme.std-screens #content .fin-po-head{background:var(--dk-raised,#1e293b)!important;border-color:var(--dk-line,#334155)!important}
body.dark-theme.std-screens #content :is(.po-summary-bar,.fin-kpis,.falcon-platform-kpis,.crm-kpis,.crm-rep-tiles,.cl-tiles)>*>strong:not(#_){color:var(--dk-text,#e5e7eb)!important}
body.dark-theme.std-screens #content table.falcon-table tbody tr:hover td{background:#1d2d46}

/* ---- Phone: list tables become cards (each cell "label  value"), figure boxes two across ---- */
@media (max-width:700px){
  body.std-screens #content{padding:12px!important}
  body.std-screens #content .panel>.panel-head:not(#_){flex-direction:row!important;flex-wrap:wrap!important;align-items:center!important;text-align:left!important;justify-content:flex-start!important}
  body.std-screens #content .panel>.panel-head>div:first-child *{text-align:left!important}
  body.std-screens #content .panel>.panel-head>div:first-child{flex:1 1 auto;min-width:0;text-align:left!important}
  body.std-screens #content .panel>.panel-head>:last-child:not(:first-child){margin-left:auto!important;width:auto!important;flex:0 0 auto}
  body.std-screens #content .panel>.panel-head>.toolbar:last-child:not(:first-child){display:grid!important;grid-template-columns:1fr 1fr;gap:8px;flex:1 1 100%;width:100%!important}
  body.std-screens #content :is(.po-summary-bar,.fin-kpis,.falcon-platform-kpis,.crm-kpis,.crm-rep-tiles,.cl-tiles){grid-template-columns:repeat(2,minmax(0,1fr))!important}
  body.std-screens #content :is(.po-summary-bar,.fin-kpis,.falcon-platform-kpis,.crm-kpis,.crm-rep-tiles,.cl-tiles)>:last-child:nth-child(odd){grid-column:1/-1}
  body.std-screens #content :is(.po-summary-bar,.fin-kpis,.falcon-platform-kpis,.crm-kpis,.crm-rep-tiles,.cl-tiles)>*>strong:not(#_){font-size:17px!important}
  body.std-screens #content .master-filterbar input[type=search]{flex:1 1 100%!important}
  body.std-screens #content .master-filterbar .std-filter-wrap{flex:1 1 calc(50% - 4px)}
  body.std-screens #content .master-filterbar .std-filter-wrap .cp-filter-btn{width:100%;justify-content:center}
  body.std-screens #content .master-filterbar .falcon-table-tools:not(#_){display:contents!important}
  body.std-screens #content .master-filterbar .falcon-table-tools select:not(#_){flex:1 1 calc(50% - 4px)!important;width:auto!important;min-width:0!important}
  body.std-screens #content .master-filterbar .falcon-table-tools .small-btn:not(#_){flex:1 1 calc(25% - 6px);min-width:0;padding:0 6px!important}
  body.std-screens #content .std-filter-pop{width:auto;max-width:none}
  /* List tables (falcon-table) as cards. Grids you type into (PO lines) keep sideways scrolling inside their box. */
  body.std-screens #content .falcon-table-wrap{overflow-x:auto!important;border:0!important}
  body.std-screens #content table.falcon-table{display:block!important;min-width:0!important;width:100%!important}
  body.std-screens #content table.falcon-table thead{display:none!important}
  body.std-screens #content table.falcon-table tbody,body.std-screens #content table.falcon-table tfoot{display:block!important}
  body.std-screens #content table.falcon-table tr:not(#_){display:grid!important;grid-template-columns:auto 1fr auto;gap:2px 10px;align-items:center;padding:10px 12px;margin:0 0 8px!important;border:1px solid var(--line,#e5e7eb)!important;border-radius:10px!important;background:var(--panel,#fff)}
  body.std-screens #content table.falcon-table td:not(#_){display:flex!important;gap:8px;grid-column:1/-1;padding:0!important;border:0!important;min-height:0!important;background:transparent!important;line-height:1.45!important;overflow-wrap:anywhere;text-align:left!important;justify-content:flex-start!important}
  body.std-screens #content table.falcon-table td[data-label]:not([data-label=""])::before{content:attr(data-label);flex:0 0 96px;color:var(--fg-secondary);font-size:var(--fs-label)}
  body.std-screens #content table.falcon-table td:empty:not(#_){display:none!important}
  body.std-screens #content table.falcon-table td .empty{white-space:normal!important;width:auto!important;min-width:0!important;padding:8px 0!important}
  body.std-screens #content table.falcon-table td.std-card-check:not(#_){grid-column:1;grid-row:1}
  body.std-screens #content table.falcon-table td.std-card-title:not(#_){grid-column:2;grid-row:1;font-size:14px;font-weight:600}
  body.std-screens #content table.falcon-table td.std-card-title::before{display:none}
  body.std-screens #content table.falcon-table td.std-card-status:not(#_){grid-column:3;grid-row:1;justify-content:flex-end}
  body.std-screens #content table.falcon-table td.std-card-status::before{display:none}
  body.std-screens #content table.falcon-table tr.falcon-row-late:not(#_){border-left:3px solid #dc2626!important}
  body.std-screens #content .falcon-po-facts{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  body.std-screens #content .falcon-po-actions{display:grid!important;grid-template-columns:1fr 1fr;width:100%}
  body.std-screens #content .falcon-po-actions>.primary{grid-column:1/-1}
  body.std-screens #content .falcon-po-actions>*,body.std-screens #content .falcon-po-actions button{width:100%}
  body.std-screens #content .falcon-tabs{overflow-x:auto;flex-wrap:nowrap!important}
  body.std-screens #content .falcon-tab{white-space:nowrap}
  body.std-screens #content .falcon-action-row:not(#_){grid-template-columns:auto 1fr!important;gap:2px 10px!important;padding:8px 10px!important;align-items:start!important}
  body.std-screens #content .falcon-action-row .falcon-action-area{grid-column:2;display:flex;gap:6px;color:var(--fg-secondary);font-size:var(--fs-label);text-align:left!important}
  body.std-screens #content .activity-item{display:grid!important;grid-template-columns:1fr auto;gap:2px 10px;padding:8px 12px!important}
  body.std-screens #content .activity-action{grid-column:1/-1;grid-row:2}
}
