        /* Stable Horse List Styles - Properly Prefixed */

.stable_horse_list_body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
}

.stable_horse_list_container {
    max-width: 1600px;
    margin: 0 auto;
}

.stable_horse_list_header {
    background: linear-gradient(to bottom, #90EE90, #7CCD7C);
    border: 3px solid #228B22;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stable_horse_list_header h1 {
    margin: 0;
    font-size: 24px;
    color: #000;
}

.stable_horse_list_header_info {
    font-size: 14px;
    font-weight: bold;
}

.stable_horse_list_table {
    width: 100%;
    table-layout: fixed;
    background-color: white;
    border-collapse: collapse;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Column widths for table-layout:fixed.
   Horse name gets a percentage to take remaining space.
   Data columns get small fixed widths.
   NOTE: Adjust these based on actual content. */
.stable_horse_list_table > thead > tr > th:first-child {
    width: 30%;  /* Horse name column — 30% leaves more room for data columns */
}
.stable_horse_list_col_quick   { width: 70px; }
.stable_horse_list_col_status  { width: 60px; }
.stable_horse_list_col_age     { width: 35px; }
.stable_horse_list_col_sex     { width: 35px; }
.stable_horse_list_col_bred    { width: 40px; }
.stable_horse_list_col_last    { width: 45px; }
.stable_horse_list_col_r       { width: 28px; }
.stable_horse_list_col_w       { width: 28px; }
.stable_horse_list_col_p       { width: 28px; }
.stable_horse_list_col_s       { width: 28px; }
.stable_horse_list_col_usd     { width: 55px; }
.stable_horse_list_col_itm     { width: 40px; }
.stable_horse_list_col_badges  { width: 75px; }
.stable_horse_list_col_expand  { width: 30px; }

.stable_horse_list_table th {
    background-color: #E8E8D0;
    padding: 8px 6px;
    text-align: left;
    font-weight: bold;
    border-bottom: 2px solid #999;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Any hidden TH/TD in the stable table must also have width:0
   so table-layout:fixed doesn't allocate dead whitespace for them */
.stable_horse_list_table th[style*="display: none"],
.stable_horse_list_table td[style*="display: none"],
.stable_horse_list_table th[style*="display:none"],
.stable_horse_list_table td[style*="display:none"] {
    width: 0 !important;
    padding: 0 !important;
    overflow: hidden;
}

.stable_horse_list_table td {
    padding: 8px 6px;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stable_horse_list_table tr:hover {
    background-color: #f9f9f9;
}

.stable_horse_list_horse_name {
    color: #006400;
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.stable_horse_list_badges {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
}

.stable_horse_list_badge {
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    color: white;
    border: 1px solid #000;
}

.stable_horse_list_badge_gp { 
    background-color: #FFD700; 
    color: black; 
}

.stable_horse_list_badge_sw { 
    background-color: #4169E1; 
}

.stable_horse_list_badge_250 { 
    background-color: #228B22; 
}

.stable_horse_list_badge_100 { 
    background-color: #228B22; 
}

.stable_horse_list_badge_500 { 
    background-color: #8B4513; 
}

.stable_horse_list_badge_gm { 
    background-color: #C0C0C0; 
    color: #000; 
}

.stable_horse_list_badge_star { 
    background-color: #FFD700; 
    color: #000; 
}

.stable_horse_list_badge_1m { 
    background-color: #4169E1; 
}

.stable_horse_list_status_active {
    color: #228B22;
    font-weight: bold;
}

.stable_horse_list_status_inactive {
    color: #999;
}

.stable_horse_list_money {
    text-align: right;
    font-weight: bold;
}

.stable_horse_list_center {
    text-align: center;
}

.stable_horse_list_right {
    text-align: right;
}

/* Expand/Collapse functionality */
.stable_horse_list_expand_toggle {
    cursor: pointer;
    color: #0066cc;
    font-weight: bold;
    user-select: none;
    display: none;
    padding: 4px 8px;
}

.stable_horse_list_expand_toggle:hover {
    color: #004499;
}

.stable_horse_list_expanded_info {
    display: none;
    padding: 10px;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    grid-column: 1 / -1;
}

.stable_horse_list_expanded_info.stable_horse_list_show {
    display: block;
}

.stable_horse_list_expanded_row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 6px;
    margin-top: 4px;
}

/* Fight style_more.css: .stable_horse_list_horse_detail_cell div { width: 100% }
   Grid items need width:auto so auto-fill can create multiple columns */
.stable_horse_list_expanded_row > div {
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
}

.stable_horse_list_expanded_item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px 8px;
    border-left: 3px solid #4a8c5c;
}

.stable_horse_list_expanded_label {
    font-weight: 700;
    font-size: 9px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stable_horse_list_expanded_value {
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

 

/* Responsive column hiding - Progressive disclosure */
@media (max-width: 1400px) {
    .stable_horse_list_col_p,
    .stable_horse_list_col_s {
        display: none;
    }
    .stable_horse_list_expand_toggle {
        display: inline-block;
    }
}

/* Scope to ONLY the cell itself and its direct child wrapper div.
   The old rule matched all descendant divs + tables which forced width:100%
   on every internal horsepage element, overriding the responsive column-hiding
   system and causing all PP columns to display regardless of viewport size. */
.stable_horse_list_horse_detail_cell > div {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* 🍞 BREADCRUMB: With table-layout:fixed + width:100%, the table always
   fills its container. The detail row's colspan="100" now spans the full
   table width, giving horsepage the space it needs. */
.stable_horse_list_horse_detail_row {
    width: 100% !important;
    background-color: #ffffff !important;
}

/* 🍞 BREADCRUMB: ehr_content.css:82 has:
       .stable_horse_list_table td:first-child { display: flex }
   This matches the detail cell TD because it's the only (thus first) child
   in the detail row. display:flex on the TD breaks the horsepage layout
   by making horsepage_wrapper a flex item instead of a normal block child.
   Fix: reset to table-cell on the detail cell specifically. */
.stable_horse_list_horse_detail_cell {
    display: table-cell !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    white-space: normal !important;
    text-overflow: clip !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   FIGHTING style_more.css
   
   style_more.css has these rules we can't edit:
     .stable_horse_list_horse_detail_cell div   { width: 100% !important; max-width: 100% !important }
     .stable_horse_list_horse_detail_cell table  { width: 100% !important; table-layout: auto !important }
     .stable_horse_list_horse_detail_cell > *    { width: 100% !important }
   
   Hostile specificity: (0,1,1) with !important.
   
   width:100% is FINE for most block-level divs (they naturally fill their parent).
   It BREAKS flex-row children and grid children, forcing them to stack vertically.
   
   Strategy: Only override width on divs that are children of multi-column 
   flex/grid containers. Use specificity (0,2,1) to beat (0,1,1).
   ═══════════════════════════════════════════════════════════════════════ */

/* --- horsepage_top: 3-column flex layout (identity | stats | right) --- */
.stable_horse_list_horse_detail_cell .horsepage_top {
    display: flex !important;
    flex-wrap: wrap !important;
}
.stable_horse_list_horse_detail_cell .horsepage_top > div {
    width: auto !important;
    max-width: none !important;
}
/* Restore the specific flex sizing on each column.
   Identity uses ~30% to roughly align with the stable table's 30% horsename column.
   Stats and right split the remaining ~70% (matching the data columns area).
   At narrow widths, flex-wrap kicks in. */
.stable_horse_list_horse_detail_cell .horsepage_identity {
    flex: 0 1 30% !important;
    width: auto !important;
    max-width: none !important;
    min-width: 180px !important;
}
.stable_horse_list_horse_detail_cell .horsepage_stats_col {
    flex: 1 1 35% !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
}
.stable_horse_list_horse_detail_cell .horsepage_right_col {
    flex: 1 1 28% !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
}

/* --- hp_info_grid: 4-column CSS grid layout (new horsepage_info.jinja) ---
   style_more.css forces width:100% !important on all descendant divs inside
   the detail cell, collapsing grid children to full-width stacked layout.
   These rules fight that with higher specificity (0,2,1) > (0,1,1). */
.stable_horse_list_horse_detail_cell .hp_info_grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
}
.stable_horse_list_horse_detail_cell .hp_info_grid > div {
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
}
/* Mirror the breakpoints defined in the jinja inline <style> */
@media (max-width: 1099px) and (min-width: 600px) {
    .stable_horse_list_horse_detail_cell .hp_info_grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
@media (max-width: 599px) {
    .stable_horse_list_horse_detail_cell .hp_info_grid {
        grid-template-columns: 1fr !important;
    }
    .stable_horse_list_horse_detail_cell .hp_info_grid > div {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* --- horsepage_pedigree_banner: full-width, must not be capped by style_more --- */
.stable_horse_list_horse_detail_cell .horsepage_pedigree_banner {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

/* --- horsepage_image_block: image + owner/breeder side by side --- */
.stable_horse_list_horse_detail_cell .horsepage_image_block > div {
    width: auto !important;
    max-width: none !important;
}

/* --- PP detail grid: cards should wrap in multi-column grid --- */
.stable_horse_list_horse_detail_cell .horsepage_pp_detail_grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important;
    min-width: 0 !important;
    /* Ensure grid doesn't use intrinsic sizing to blow out the table */
    width: 100% !important;
}
.stable_horse_list_horse_detail_cell .horsepage_pp_detail_grid > div {
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
}

/* The PP detail row's TD (colspan) needs a definite width for CSS Grid's
   auto-fill to calculate how many columns fit. In table-layout:auto, the TD
   has no definite width, so auto-fill falls back to 1 column.
   Fix: give the TD width:100% AND overflow:hidden. The overflow creates a
   block formatting context that gives the grid a definite width to work with,
   while preventing the grid from expanding the TD beyond the table. */
.stable_horse_list_horse_detail_cell .horsepage_pp_detail_row > td {
    width: 100% !important;
    overflow: hidden !important;
    /* Give the grid breathing room */
    padding: 10px 12px !important;
}

/* --- Owner grid children --- */
.stable_horse_list_horse_detail_cell .horsepage_owner_grid > div {
    width: auto !important;
    max-width: none !important;
}

/* --- RAFI two-column layout --- */
.stable_horse_list_horse_detail_cell .horsepage_rafi_2col > div {
    width: auto !important;
    max-width: none !important;
}
.stable_horse_list_horse_detail_cell .horsepage_rafi_body > div {
    width: auto !important;
    max-width: none !important;
}

/* --- Dam header (label + button side by side) --- */
.stable_horse_list_horse_detail_cell .horsepage_dam_header > * {
    width: auto !important;
    max-width: none !important;
}

/* --- Badges row --- */
.stable_horse_list_horse_detail_cell .horsepage_badges > * {
    width: auto !important;
    max-width: none !important;
}

/* --- Control/checkbox rows --- */
.stable_horse_list_horse_detail_cell .horsepage_control_row > * {
    width: auto !important;
    max-width: none !important;
}
.stable_horse_list_horse_detail_cell .horsepage_checkbox_row > * {
    width: auto !important;
    max-width: none !important;
}

/* --- PP icon row --- */
.stable_horse_list_horse_detail_cell .horsepage_pp_icons > * {
    width: auto !important;
    max-width: none !important;
}

/* --- Stat grid (the 2x4 stat cards) --- */
.stable_horse_list_horse_detail_cell .horsepage_stat_grid {
    display: grid !important;
}
.stable_horse_list_horse_detail_cell .horsepage_stat_grid > div {
    width: auto !important;
    max-width: none !important;
}

/* --- RAFI tabs, selects, buttons --- */
.stable_horse_list_horse_detail_cell .horsepage_rafi_tabs > * {
    width: auto !important;
    max-width: none !important;
}
.stable_horse_list_horse_detail_cell .horsepage_rafi_select_row > * {
    width: auto !important;
    max-width: none !important;
}
.stable_horse_list_horse_detail_cell .horsepage_rafi_buttons > * {
    width: auto !important;
    max-width: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   HORSEPAGE RESPONSIVE INSIDE DETAIL CELL
   These handle the 3→2→1 column transition for the horsepage_top flex
   layout when inside the stable list's detail cell.
   ═══════════════════════════════════════════════════════════════════════ */

/* At ~1100px: right column wraps below, identity + stats stay side by side */
@media (max-width: 1100px) {
    .stable_horse_list_horse_detail_cell .horsepage_identity {
        flex: 0 1 35% !important;
        width: 35% !important;
        max-width: 35% !important;
    }
    .stable_horse_list_horse_detail_cell .horsepage_stats_col {
        flex: 1 1 55% !important;
    }
    .stable_horse_list_horse_detail_cell .horsepage_right_col {
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* At ~768px: everything stacks to single column */
@media (max-width: 768px) {
    .stable_horse_list_horse_detail_cell .horsepage_identity {
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .stable_horse_list_horse_detail_cell .horsepage_stats_col {
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .stable_horse_list_horse_detail_cell .horsepage_right_col {
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}

@media (max-width: 1300px) {
    .stable_horse_list_col_bred {
        display: none;
        width: 0 !important;
        padding: 0 !important;
        overflow: hidden;
    }
}

@media (max-width: 1200px) {
    .stable_horse_list_col_r {
        display: none;
        width: 0 !important;
        padding: 0 !important;
        overflow: hidden;
    }
}

@media (max-width: 1100px) {
    .stable_horse_list_col_itm {
        display: none;
        width: 0 !important;
        padding: 0 !important;
        overflow: hidden;
    }
}

@media (max-width: 1000px) {
    .stable_horse_list_col_usd {
        display: none;
        width: 0 !important;
        padding: 0 !important;
        overflow: hidden;
    }
}

@media (max-width: 900px) {
    .stable_horse_list_col_w {
        display: none;
        width: 0 !important;
        padding: 0 !important;
        overflow: hidden;
    }
}

@media (max-width: 800px) {
    .stable_horse_list_col_badges {
        display: none;
        width: 0 !important;
        padding: 0 !important;
        overflow: hidden;
    }
}

@media (max-width: 700px) {
    .stable_horse_list_col_sex {
        display: none;
        width: 0 !important;
        padding: 0 !important;
        overflow: hidden;
    }
}

@media (max-width: 650px) {
    .stable_horse_list_col_age {
        display: none;
        width: 0 !important;
        padding: 0 !important;
        overflow: hidden;
    }
}

@media (max-width: 600px) {
    .stable_horse_list_col_last {
        display: none;
        width: 0 !important;
        padding: 0 !important;
        overflow: hidden;
    }
}

@media (max-width: 550px) {
    .stable_horse_list_col_quick {
        display: none;
        width: 0 !important;
        padding: 0 !important;
        overflow: hidden;
    }
    .stable_horse_list_table > thead > tr > th:first-child {
        width: 70%;
    }
}

@media (max-width: 500px) {
    .stable_horse_list_col_status {
        display: none;
        width: 0 !important;
        padding: 0 !important;
        overflow: hidden;
    }
    .stable_horse_list_table > thead > tr > th:first-child {
        width: 90%;
    }
}

/* Extra small screens - final adjustments */
@media (max-width: 400px) {
    .stable_horse_list_table {
        font-size: 11px;
    }
    
    .stable_horse_list_table th,
    .stable_horse_list_table td {
        padding: 6px 4px;
    }
    
    .stable_horse_list_horse_name {
        font-size: 12px;
    }
}

/* =============================================================================
   delta_stable_notes.css
   Notes section inside stable list expanded row
   ============================================================================= */

.shl_notes_row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px 6px;
}

.shl_notes_input {
  width: 100%;
  font-size: 13px;
  line-height: 1.5;
  padding: 6px 8px;
  border: 1px solid #cdd4dc;
  border-radius: 4px;
  resize: vertical;
  color: #334155;
  background: #fff;
  font-family: inherit;
}

.shl_notes_input:focus {
  outline: none;
  border-color: #6a9ec4;
  box-shadow: 0 0 0 2px rgba(106,158,196,0.15);
}

.shl_notes_save_btn {
  width: 100%;
  padding: 8px 16px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #fff !important;
  background: #3a7abf !important;
  border: none !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  min-height: 34px !important;
  line-height: 1.4 !important;
  text-indent: 0 !important;
  letter-spacing: normal !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.shl_notes_save_btn::before,
.shl_notes_save_btn::after {
  display: none !important;
}

.shl_notes_save_btn:hover  { background: #2e649e; }
.shl_notes_save_btn:disabled { opacity: 0.6; cursor: default; }

/* Feedback — shared with horsepage */
.hp_saveresult      { padding: 4px 10px; border-radius: 4px; font-size: 12px; margin: 0 10px 6px; }
.hp_saveresult_ok   { color: #2a6a2a; background: #eaf5ea; }
.hp_saveresult_fail { color: #8a1f1f; background: #fdeaea; }

.shl_notes_loading {
  font-size: 12px;
  color: #64748b;
  font-style: italic;
  padding: 6px 2px;
}