/* v17.318: standalone mobile-friendly statistical research tab */
/* Desktop navigation uses display:flex!important; ensure private hidden entries stay hidden. */
#leftSidebar .side-btn.hidden {display:none!important}
#statAiScreen {min-width:0}
#statAiScreen .card {min-width:0}
#statAiScreen h3 {margin:0 0 10px;font-size:1.08rem}
#statAiScreen .rp-stat-ai-tag {display:inline-block;padding:4px 9px;border:1px solid #4d6b8d;border-radius:999px;color:#b4d7ff;font-size:11px;vertical-align:middle;white-space:nowrap}
#statAiScreen .rp-stat-ai-toolbar {display:flex;flex-wrap:wrap;align-items:end;gap:12px;margin:15px 0 8px}
#statAiScreen .rp-stat-ai-toolbar label {display:flex;flex-direction:column;gap:6px;font-weight:700;color:#e5edf8}
#statAiScreen .rp-stat-ai-toolbar select {min-width:155px;max-width:100%;padding:10px 12px;border:1px solid #537293;border-radius:8px;background:#0c2139;color:#f4f8ff;font:inherit}
#statAiScreen .rp-stat-ai-metrics {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,150px),1fr));gap:10px}
#statAiScreen .rp-stat-ai-metric {padding:12px;background:#10253a;border:1px solid #2f506d;border-radius:10px;min-width:0;overflow-wrap:anywhere}
#statAiScreen .rp-stat-ai-metric span {display:block;font-size:12px}
#statAiScreen .rp-stat-ai-metric strong {display:block;margin-top:8px;font-size:19px;font-variant-numeric:tabular-nums}
#statAiScreen details summary {cursor:pointer;font-weight:800;padding:6px 0}
#statAiScreen .rp-stat-ai-table-wrap {overflow-x:auto;max-width:100%;-webkit-overflow-scrolling:touch}
#statAiScreen .rp-stat-ai-table-wrap table {width:100%;border-collapse:collapse;min-width:660px;font-size:12px}
#statAiScreen .rp-stat-ai-table-wrap th,#statAiScreen .rp-stat-ai-table-wrap td {padding:10px 9px;text-align:left;border-bottom:1px solid #33516b;vertical-align:top;white-space:nowrap}
#statAiScreen .rp-stat-ai-table-wrap th {color:#c1d6eb;font-weight:800}
#statAiScreen #statAiCandidatesBody td:first-child {min-width:180px;white-space:normal;overflow-wrap:anywhere}
#statAiScreen #statAiStatus {min-height:1.3em;overflow-wrap:anywhere}
#statAiScreen .rp-stat-ai-disclaimer p {color:#b5c4d4;line-height:1.6;font-size:13px}
@media(max-width:620px){
 #statAiScreen .rp-stat-ai-toolbar {align-items:stretch}
 #statAiScreen .rp-stat-ai-toolbar label {flex:1 1 100%}
 #statAiScreen .rp-stat-ai-toolbar select {width:100%}
 #statAiScreen .rp-stat-ai-toolbar button {width:100%;min-height:42px}
 #statAiScreen .rp-stat-ai-metric strong {font-size:17px}
 #statAiScreen .rp-stat-ai-table-wrap table {font-size:11px}
}

/* v17.319: compact training/validation comparison (only true saved metrics) */
#statAiScreen .rp-stat-ai-rank-table {font-variant-numeric:tabular-nums;min-width:800px}
#statAiScreen .rp-stat-ai-rank-table th,#statAiScreen .rp-stat-ai-rank-table td {text-align:center;vertical-align:middle;padding:10px 8px}
#statAiScreen .rp-stat-ai-rank-table th {background:#122d48;color:#e3eefe}
#statAiScreen .rp-stat-ai-rank-table th:nth-child(3),#statAiScreen .rp-stat-ai-rank-table td:nth-child(3) {text-align:left}
#statAiScreen .rp-stat-ai-rank-table tbody tr:nth-child(even) {background:rgba(32,63,92,.32)}
#statAiScreen .rp-stat-ai-rank-table tbody tr:first-child {outline:1px solid #cca831;outline-offset:-1px}
#statAiScreen .rp-stat-ai-formation {display:flex;align-items:center;gap:2px;margin-bottom:5px;white-space:nowrap;font-size:14px;font-weight:800}
#statAiScreen .rp-stat-ai-boat {display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:21px;padding:0 2px;border-radius:3px;font-size:12px;line-height:1;color:white}
#statAiScreen .rp-stat-ai-boat-1 {background:#f0f4f7;color:#111d29}
#statAiScreen .rp-stat-ai-boat-2 {background:#222831;border:1px solid #92a9bf}
#statAiScreen .rp-stat-ai-boat-3 {background:#de4242}
#statAiScreen .rp-stat-ai-boat-4 {background:#357ddd}
#statAiScreen .rp-stat-ai-boat-5 {background:#e2b52b;color:#15283b}
#statAiScreen .rp-stat-ai-boat-6 {background:#1c975d}
#statAiScreen .rp-stat-ai-boat-全 {background:#516477}
#statAiScreen .rp-stat-ai-dash {padding:0 2px;color:#b9cbda}
#statAiScreen .rp-stat-ai-condition {max-width:260px;white-space:normal;font-size:11px;color:#b7cbdc;line-height:1.4;overflow-wrap:anywhere}
#statAiScreen .rp-stat-ai-rate {font-weight:700;color:#deebf7}
#statAiScreen .rp-stat-ai-roi {font-weight:800;font-size:13px}
#statAiScreen .rp-stat-ai-positive {color:#75d8a2}
#statAiScreen .rp-stat-ai-negative {color:#f5c36b}
#statAiScreen .rp-stat-ai-rank-note {font-size:12px;line-height:1.55}
@media(max-width:620px){
  #statAiScreen .rp-stat-ai-rank-table {min-width:800px;font-size:11px}
  #statAiScreen .rp-stat-ai-rank-table th,#statAiScreen .rp-stat-ai-rank-table td {padding:8px 6px}
}

/* v17.320: four-season descriptive evidence table. Read-only, max eight rows. */
#statAiScreen .rp-stat-ai-season-table {min-width:1030px;font-variant-numeric:tabular-nums}
#statAiScreen .rp-stat-ai-season-table th,#statAiScreen .rp-stat-ai-season-table td {text-align:center;vertical-align:middle;padding:9px 8px}
#statAiScreen .rp-stat-ai-season-table th {background:#122d48;color:#e3eefe}
#statAiScreen .rp-stat-ai-season-table th:first-child,#statAiScreen .rp-stat-ai-season-table td:first-child {text-align:left;min-width:190px;white-space:normal}
#statAiScreen .rp-stat-ai-season-table tbody tr:nth-child(even){background:rgba(32,63,92,.32)}
#statAiScreen .rp-stat-ai-season-table .rp-stat-ai-condition {font-size:11px;line-height:1.5}
#statAiScreen .rp-stat-ai-season-toolbar {margin:12px 0}
@media(max-width:620px){#statAiScreen .rp-stat-ai-season-table{min-width:1030px;font-size:11px}}

/* v17.321: interactive condition comparison, readable on desktop and mobile. */
#statAiScreen .rp-stat-ai-filter-toolbar label {flex:1 1 145px;min-width:0}
#statAiScreen .rp-stat-ai-filter-toolbar select {width:100%;min-width:0}
#statAiScreen .rp-stat-ai-filter-toolbar button {flex:0 0 auto}
#statAiScreen .rp-stat-ai-filter-status {padding:12px;margin:12px 0;background:#102c43;border:1px solid #375a75;border-radius:8px;color:#d5e9fa;line-height:1.55;font-size:13px}
#statAiScreen .rp-stat-ai-filtered-table {min-width:890px}
#statAiScreen .rp-stat-ai-filtered-table th:first-child,#statAiScreen .rp-stat-ai-filtered-table td:first-child {min-width:96px;white-space:nowrap}
@media(max-width:620px){
  #statAiScreen .rp-stat-ai-filter-toolbar {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
  #statAiScreen .rp-stat-ai-filter-toolbar label {min-width:0}
  #statAiScreen .rp-stat-ai-filter-toolbar button {width:100%}
}

/* v17.322: research import & custom formation inputs */
#statAiScreen .rp-stat-ai-import-toolbar label {flex:1 1 150px;min-width:0}
#statAiScreen .rp-stat-ai-import-toolbar input,
#statAiScreen .rp-stat-ai-filter-toolbar input {box-sizing:border-box;min-width:0;width:100%;padding:10px 12px;
  border:1px solid #537293;border-radius:8px;background:#0c2139;color:#f4f8ff;font:inherit}
#statAiScreen .rp-stat-ai-import-toolbar button:disabled {opacity:.5;cursor:not-allowed}
#statAiScreen #statAiImportVenueCount {font-size:13px;padding:5px 0 9px;line-height:1.6}
@media(max-width:620px){#statAiScreen .rp-stat-ai-import-toolbar label {flex:1 1 100%}}


/* v17.323: owner statistical tab mobile layout. Desktop tables remain unchanged. */
@media screen and (max-width: 620px) {
  #statAiScreen, #statAiScreen .card, #statAiScreen .section,
  #statAiScreen .rp-stat-ai-toolbar, #statAiScreen .rp-stat-ai-table-wrap {
    box-sizing: border-box; min-width: 0; max-width: 100%;
  }
  #statAiScreen .card { overflow: hidden; }
  #statAiScreen .rp-stat-ai-import-toolbar,
  #statAiScreen .rp-stat-ai-filter-toolbar {display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-items: stretch;}
  #statAiScreen .rp-stat-ai-import-toolbar label,
  #statAiScreen .rp-stat-ai-filter-toolbar label { display:flex; flex-direction:column; min-width:0; max-width:100%; width:100%; overflow:hidden; }
  #statAiScreen .rp-stat-ai-import-toolbar input[type="date"],
  #statAiScreen .rp-stat-ai-filter-toolbar input,
  #statAiScreen .rp-stat-ai-toolbar select {
    display:block; box-sizing:border-box; width:100%; min-width:0; max-width:100%;
    min-height:46px; font-size:16px; padding:9px 11px;
  }
  #statAiScreen .rp-stat-ai-import-toolbar button,
  #statAiScreen .rp-stat-ai-filter-toolbar button { box-sizing:border-box; width:100%; max-width:100%; min-width:0; min-height:46px; white-space:normal; overflow-wrap:anywhere; }
  #statAiScreen .rp-stat-ai-import-toolbar button:disabled {min-height:46px;}
  #statAiScreen .rp-stat-ai-filter-status, #statAiScreen #statAiImportVenueCount {overflow-wrap:anywhere; word-break:normal;}

  /* Each saved-statistics row becomes a labeled vertical card; no horizontal table swipe. */
  #statAiScreen .rp-stat-ai-table-wrap { overflow-x:visible; -webkit-overflow-scrolling:auto; }
  #statAiScreen .rp-stat-ai-table-wrap table,
  #statAiScreen .rp-stat-ai-table-wrap .rp-stat-ai-season-table,
  #statAiScreen .rp-stat-ai-table-wrap .rp-stat-ai-rank-table,
  #statAiScreen .rp-stat-ai-table-wrap .rp-stat-ai-filtered-table {
    display:block; width:100%; min-width:0; max-width:100%; table-layout:auto;
    font-size:13px;
  }
  #statAiScreen .rp-stat-ai-table-wrap thead {display:none;}
  #statAiScreen .rp-stat-ai-table-wrap tbody {display:grid; grid-template-columns:minmax(0,1fr); gap:12px; width:100%;}
  #statAiScreen .rp-stat-ai-table-wrap tbody tr {
    display:grid; grid-template-columns:minmax(0,1fr); gap:0; min-width:0;
    padding:12px; border-radius:12px; border:1px solid #385b79;
    background:#10263e; box-sizing:border-box;
  }
  #statAiScreen .rp-stat-ai-table-wrap tbody tr:nth-child(even) {background:#102a43;}
  #statAiScreen .rp-stat-ai-table-wrap tbody tr:first-child {outline:none;}
  #statAiScreen .rp-stat-ai-table-wrap tbody td,
  #statAiScreen .rp-stat-ai-season-table td,
  #statAiScreen .rp-stat-ai-rank-table td,
  #statAiScreen .rp-stat-ai-filtered-table td {
    display:grid; grid-template-columns:minmax(94px, 43%) minmax(0, 1fr);
    align-items:start; gap:8px; box-sizing:border-box;
    width:100%; min-width:0; max-width:100%;
    min-height:34px; padding:8px 0; text-align:right;
    border-bottom:1px solid rgba(142,177,209,.16);
    white-space:normal; overflow-wrap:anywhere;
  }
  #statAiScreen .rp-stat-ai-table-wrap tbody td:last-child {border-bottom:0;}
  #statAiScreen .rp-stat-ai-table-wrap tbody td::before {
    content:attr(data-mobile-label); display:block; text-align:left; color:#a8c8e6;
    font-size:11px; font-weight:700; line-height:1.5;
  }
  #statAiScreen .rp-stat-ai-table-wrap tbody td:first-child {
    display:block; text-align:left; min-width:0; max-width:100%;
    padding:4px 0 12px; margin-bottom:3px; border-bottom:1px solid #426481;
    font-size:14px; font-weight:750;
  }
  #statAiScreen .rp-stat-ai-table-wrap tbody td:first-child::before {
    content:attr(data-mobile-label); margin-bottom:5px;
  }
  #statAiScreen .rp-stat-ai-table-wrap tbody td[colspan] {display:block; text-align:left; padding:10px 0; font-weight:normal; border:0;}
  #statAiScreen .rp-stat-ai-table-wrap tbody td[colspan]::before {display:none;}
  #statAiScreen .rp-stat-ai-condition {max-width:100%; white-space:normal;}
  #statAiScreen .rp-stat-ai-formation {justify-content:flex-start; flex-wrap:wrap; white-space:normal;}
  #statAiScreen .rp-stat-ai-roi {font-size:15px;}
}
/* v17.324 daily saved-data monitor */
#statAiScreen .rp-stat-ai-audit-toolbar label{flex:1 1 170px;min-width:0}
#statAiScreen .rp-stat-ai-audit-toolbar input[type=date]{width:100%;min-width:0;max-width:100%;box-sizing:border-box}
#statAiScreen .rp-stat-ai-audit-list{display:grid;gap:10px;margin-top:12px}
#statAiScreen .rp-stat-ai-audit-venue{border:1px solid rgba(140,180,225,.3);border-radius:10px;padding:10px 13px;min-width:0;overflow-wrap:anywhere}
#statAiScreen .rp-stat-ai-audit-venue summary{cursor:pointer;font-weight:650;line-height:1.6}
#statAiScreen .rp-stat-ai-audit-fields{padding:8px 0 0;font-size:.92em}
#statAiScreen .rp-stat-ai-audit-fields p{margin:6px 0}
@media(max-width:620px){#statAiScreen .rp-stat-ai-audit-toolbar,#statAiScreen .rp-stat-ai-audit-toolbar label,#statAiScreen .rp-stat-ai-audit-toolbar button{width:100%;max-width:100%;min-width:0;box-sizing:border-box}}

/* v17.325: compact, accessible daily-audit status cards and iOS dark date input */
#statAiScreen #statAiAuditDate {
  appearance:auto; -webkit-appearance:auto; color-scheme:dark;
  display:block; width:100%; min-width:0; max-width:100%; box-sizing:border-box;
  min-height:48px; padding:10px 14px; border:1px solid #577a9c;
  border-radius:12px; background:#10263f !important; color:#f1f7ff !important;
  -webkit-text-fill-color:#f1f7ff; font:inherit; font-size:16px;
}
#statAiScreen #statAiAuditDate::-webkit-calendar-picker-indicator{opacity:1;filter:invert(1);cursor:pointer}
#statAiScreen #statAiAuditDate::-webkit-datetime-edit,
#statAiScreen #statAiAuditDate::-webkit-datetime-edit-text,
#statAiScreen #statAiAuditDate::-webkit-datetime-edit-month-field,
#statAiScreen #statAiAuditDate::-webkit-datetime-edit-day-field,
#statAiScreen #statAiAuditDate::-webkit-datetime-edit-year-field {color:#f1f7ff; -webkit-text-fill-color:#f1f7ff}
#statAiScreen .rp-stat-ai-audit-venue {padding:0; overflow:hidden; border:1px solid #355573; border-radius:14px; background:linear-gradient(110deg,#122b44,#0d2138)}
#statAiScreen .rp-stat-ai-audit-venue summary {list-style:none;display:flex;align-items:center;justify-content:space-between;gap:10px; padding:15px 16px 9px;line-height:1.4}
#statAiScreen .rp-stat-ai-audit-venue summary::-webkit-details-marker {display:none}
#statAiScreen .rp-audit-main{display:flex; flex-direction:column;gap:4px;min-width:0}
#statAiScreen .rp-audit-name{font-size:17px;color:#f4f7fb;font-weight:800}
#statAiScreen .rp-audit-meta{font-size:12px;font-weight:500;color:#b1c6dc}
#statAiScreen .rp-audit-right{display:flex;align-items:center;gap:8px;flex-shrink:0}
#statAiScreen .rp-audit-badge{padding:5px 8px;border:1px solid #a17a4e;background:#382e26;color:#ffd7a2;border-radius:100px;font-size:11px;font-weight:750;white-space:nowrap}
#statAiScreen .rp-audit-complete .rp-audit-badge{background:#153e38;border-color:#3e8f79;color:#aaf0d5}
#statAiScreen .rp-audit-missing .rp-audit-badge{background:#422c32;border-color:#9c5863;color:#ffd0d3}
#statAiScreen .rp-audit-chevron{font-size:22px;line-height:1;color:#a5bcd1;transition:transform .18s}
#statAiScreen details[open] .rp-audit-chevron{transform:rotate(180deg)}
#statAiScreen .rp-audit-progress{height:4px;margin:0 16px 13px;background:#29465f;border-radius:10px;overflow:hidden}
#statAiScreen .rp-audit-progress>div{height:100%;background:#e4ae70;border-radius:10px}
#statAiScreen .rp-audit-complete .rp-audit-progress>div{background:#67c8a8}
#statAiScreen .rp-stat-ai-audit-fields{border-top:1px solid #355573;padding:8px 15px 13px;display:grid;gap:0}
#statAiScreen .rp-audit-field{padding:9px 0;display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap;border-bottom:1px solid rgba(120,164,202,.15);font-size:13px}
#statAiScreen .rp-audit-field:last-child{border:0}
#statAiScreen .rp-audit-field strong{font-variant-numeric:tabular-nums;font-size:13px;color:#e8f3ff}
#statAiScreen .rp-audit-missing{width:100%;color:#ffd3a3;font-size:12px;overflow-wrap:anywhere}
@media(max-width:620px){
 #statAiScreen .rp-stat-ai-audit-toolbar{display:grid;grid-template-columns:minmax(0,1fr);gap:12px}
 #statAiScreen .rp-stat-ai-audit-toolbar label{width:100%;min-width:0;max-width:100%;overflow:hidden}
 #statAiScreen .rp-stat-ai-audit-toolbar button{width:100%}
 #statAiScreen .rp-audit-name{font-size:16px}
 #statAiScreen .rp-audit-badge{font-size:10px;padding:5px 7px}
 #statAiScreen .rp-stat-ai-audit-venue summary{gap:6px;padding:14px 12px 9px}
 #statAiScreen .rp-audit-progress{margin:0 12px 12px}
}

/* v17.335: Draw date border on wrapper, not on iOS native date control. */
#statAiScreen .rp-stat-ai-audit-toolbar label {display:flex; flex-direction:column; gap:8px; min-width:0; box-sizing:border-box;}
#statAiScreen .rp-stat-ai-date-shell {display:flex; align-items:center; width:100%; min-width:0; max-width:100%; overflow:hidden; box-sizing:border-box; border:1px solid #6489a9; border-radius:12px; background:#10263f;}
#statAiScreen .rp-stat-ai-date-shell:focus-within {outline:2px solid #78bbe8; outline-offset:1px;}
#statAiScreen .rp-stat-ai-date-shell #statAiAuditDate {appearance:none; -webkit-appearance:none; width:100%; min-width:0; max-width:100%; flex:1 1 0; border:0!important; outline:0; box-shadow:none!important; border-radius:0!important; background:transparent!important; box-sizing:border-box; padding:11px 14px; margin:0; text-align:center; color-scheme:dark;}
#statAiScreen .rp-audit-stat-details {margin-top:10px; padding:12px 0 0; border-top:1px solid #53738d;}
#statAiScreen .rp-audit-stat-details>strong {display:block; font-size:14px; margin-bottom:6px;}
#statAiScreen .rp-audit-stat-details>p {font-size:12px; color:#b3c8db; line-height:1.5; margin:4px 0 10px;}
#statAiScreen .rp-audit-stat-row {display:flex; justify-content:space-between; flex-wrap:wrap; gap:6px; padding:8px 0; border-bottom:1px solid #29455d; font-size:13px;}
#statAiScreen .rp-audit-stat-row>strong {font-size:13px; color:#f3f6ff;}
#statAiScreen .rp-audit-stat-row>small {flex-basis:100%; overflow-wrap:anywhere; color:#ffd0a3; font-size:12px;}
#statAiScreen .rp-audit-stat-warning {display:block; margin-top:5px; color:#ffd0a3; font-size:11px; font-weight:700;}
