/* ═══ HORSE CARDS — GRID ═══ */
.horse-badge{display:inline-block;font-size:10px;padding:2px 7px;border-radius:10px;margin-top:4px}
.badge-barn{background:#e8f0e0;color:#2d6a4f}
.badge-owned{background:#faeeda;color:#633806}
.badge-owner-only{background:#fdecea;color:#8b2020}
.badge-full-lease{background:#e8f4fd;color:#0c447c}
.badge-partial-lease{background:#f0e8ff;color:#5b2d8e}

.herd-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}
@media(min-width:580px){.herd-grid{grid-template-columns:repeat(3,1fr)}}
@media(min-width:860px){.herd-grid{grid-template-columns:repeat(4,1fr)}}

.herd-grid-card{background:var(--white);border-radius:14px;border:1px solid var(--sand);overflow:hidden;cursor:pointer;transition:box-shadow 0.15s,border-color 0.15s}
.herd-grid-card:active{border-color:var(--earth-light);box-shadow:0 2px 12px rgba(0,0,0,0.08)}
.herd-grid-photo{aspect-ratio:1;background:var(--cream-dark);display:flex;align-items:center;justify-content:center;position:relative;overflow:hidden}
.herd-grid-initial{font-family:'Cormorant Garamond',serif;font-size:52px;color:var(--earth);opacity:0.45;line-height:1;user-select:none}
.herd-grid-delete{position:absolute;top:6px;right:6px;width:22px;height:22px;border-radius:50%;border:none;background:rgba(0,0,0,0.3);color:#fff;font-size:11px;cursor:pointer;display:flex;align-items:center;justify-content:center;line-height:1;padding:0}
.herd-grid-body{padding:10px 12px 12px}
.herd-grid-name{font-family:'Cormorant Garamond',serif;font-size:18px;font-weight:500;color:var(--earth);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:5px}
.herd-grid-footer{display:flex;align-items:center;gap:6px}
.herd-status{font-size:10px;font-weight:600;padding:2px 8px;border-radius:10px;letter-spacing:0.03em}
.herd-status-active{background:#e8f5e9;color:#2e7d32}
.herd-status-light{background:#e3f2fd;color:#1565c0}
.herd-status-rest{background:#fff8e1;color:#e65100}
.herd-status-rehab{background:#fce4ec;color:#c62828}
.herd-alert-icon{width:18px;height:18px;border-radius:50%;background:#c0392b;color:#fff;font-size:11px;font-weight:700;display:inline-flex;align-items:center;justify-content:center;line-height:1;flex-shrink:0}

/* ═══ HORSE PROFILE ═══ */
.hprofile-header{padding:16px 16px 14px;border-bottom:1px solid var(--cream-dark)}
.hprofile-header-top{display:flex;gap:14px;align-items:flex-start}
.hprofile-photo{width:72px;height:72px;border-radius:12px;overflow:hidden;background:var(--cream-dark);display:flex;align-items:center;justify-content:center;flex-shrink:0}
.hprofile-initial{width:72px;height:72px;border-radius:12px;background:var(--hay);display:flex;align-items:center;justify-content:center;font-size:28px;font-weight:700;color:#fff;flex-shrink:0}
.hprofile-title{flex:1;min-width:0}
.hprofile-name{font-size:20px;font-weight:700;color:var(--text);margin-bottom:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hprofile-badges{display:flex;gap:6px;flex-wrap:wrap;align-items:center;margin-bottom:8px}
.hprofile-meta-list{display:grid;grid-template-columns:auto 1fr;gap:4px 12px}
.hprofile-meta-row{display:contents}
.hprofile-meta-lbl{font-size:12px;font-weight:600;color:var(--text-muted);white-space:nowrap;line-height:1.6}
.hprofile-meta-val{font-size:13px;color:var(--text);font-weight:500;line-height:1.6}
.hprofile-riders{display:flex;flex-wrap:wrap;gap:4px;align-items:center}
.hprofile-rider-chip{font-size:11px;font-weight:500;background:var(--cream-dark);color:var(--text);padding:2px 8px;border-radius:10px}

.hprofile-actions{display:flex;gap:8px;flex-wrap:wrap;padding:14px 16px 20px;border-top:1px solid var(--cream-dark)}
.hprofile-action-btn{flex:1;min-width:90px;font-size:12px;font-weight:600;padding:9px 10px;border-radius:24px;border:none;background:var(--primary);color:#fff;cursor:pointer;font-family:inherit;text-align:center;transition:all 0.15s}
.hprofile-action-btn:active{background:var(--primary-dark)}
.hprofile-action-flag{background:var(--primary);color:#fff}
.hprofile-action-flag:active{background:var(--primary-dark)}

.hprofile-section{padding:14px 16px;border-bottom:1px solid var(--cream-dark)}
.hprofile-section-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.hprofile-section-head span{font-size:13px;font-weight:700;letter-spacing:0.04em;text-transform:uppercase;color:var(--text-muted)}
.hprofile-add-btn{font-size:12px;font-weight:600;color:var(--earth);background:none;border:none;cursor:pointer;padding:0;font-family:inherit}
.hprofile-add-btn:hover{text-decoration:underline}
.hprofile-empty{font-size:13px;color:var(--text-muted);font-style:italic}

.hprofile-note{background:var(--cream-dark);border-radius:8px;padding:10px 12px;margin-bottom:8px}
.hprofile-note-text{font-size:13px;color:var(--text);margin-bottom:4px;line-height:1.4}
.hprofile-note-meta{font-size:11px;color:var(--text-muted)}

.hprofile-kv-row{display:flex;gap:8px;margin-bottom:6px;font-size:13px}
.hprofile-kv-label{color:var(--text-muted);min-width:110px;flex-shrink:0}
.hprofile-kv-val{color:var(--text);font-weight:500}

.hprofile-activity-row{display:flex;gap:10px;align-items:flex-start;padding:8px 0;border-bottom:1px solid var(--cream-dark)}
.hprofile-activity-row:last-child{border-bottom:none}
.hprofile-activity-dot{width:8px;height:8px;border-radius:50%;background:var(--hay);flex-shrink:0;margin-top:4px}
.hprofile-activity-body{flex:1;min-width:0}
.hprofile-activity-title{font-size:13px;color:var(--text);font-weight:500}
.hprofile-activity-notes{font-size:12px;color:var(--text-muted);margin-top:1px}
.hprofile-activity-date{font-size:11px;color:var(--text-muted);flex-shrink:0;white-space:nowrap}

.hprofile-flag{background:#fdf0ef;border:1px solid #f5c6c0;border-radius:8px;padding:10px 12px;margin-bottom:8px}
.hprofile-flag-type{display:inline-block;font-size:10px;font-weight:700;letter-spacing:0.07em;text-transform:uppercase;color:#c0392b;background:#fad5d0;border-radius:6px;padding:2px 7px;margin-bottom:4px}
.hprofile-flag-text{font-size:13px;color:var(--text);margin-bottom:4px;line-height:1.4}
.hprofile-flag-date{font-size:11px;color:var(--text-muted)}
.hprofile-flag-resolve{font-size:11px;font-weight:600;color:#1e7a3f;background:none;border:none;cursor:pointer;padding:4px 0 0;font-family:inherit}
.hprofile-flag-resolve:hover{text-decoration:underline}

/* ── Photo wrap & upload button ── */
.hprofile-photo-wrap{position:relative;flex-shrink:0}
.hprofile-photo-lg{width:96px;height:96px;border-radius:14px;overflow:hidden;background:var(--cream-dark);display:flex;align-items:center;justify-content:center}
.hprofile-silhouette{font-family:'Cormorant Garamond',serif;font-size:52px;color:var(--earth);opacity:0.4;line-height:1;user-select:none}
.hprofile-upload-btn{position:absolute;bottom:4px;right:4px;width:26px;height:26px;border-radius:50%;border:2px solid #fff;background:rgba(0,0,0,0.55);color:#fff;font-size:13px;cursor:pointer;display:flex;align-items:center;justify-content:center;line-height:1;padding:0}
.hprofile-upload-btn:hover{background:rgba(0,0,0,0.75)}

/* ── Workload summary ── */
.hprofile-train-section{padding-bottom:0}
.hprofile-workload{background:var(--cream-dark);border-radius:10px;padding:12px;margin:0 0 4px}
.hprofile-wl-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;text-align:center}
@media(max-width:380px){.hprofile-wl-grid{grid-template-columns:repeat(2,1fr)}}
.hprofile-wl-item{}
.hprofile-wl-val{font-size:14px;font-weight:700;color:var(--earth);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hprofile-wl-lbl{font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:0.05em;color:var(--text-muted);margin-top:2px}
.hprofile-wl-focus{font-size:12px;color:var(--text);margin-top:10px;padding-top:8px;border-top:1px solid var(--sand);font-style:italic}

/* ── Sub-sections inside training card ── */
.hprofile-subsec{padding:10px 0 0;border-top:1px solid var(--cream-dark);margin-top:10px}
.hprofile-subsec-head{display:flex;align-items:center;justify-content:space-between;font-size:12px;font-weight:700;letter-spacing:0.04em;text-transform:uppercase;color:var(--text-muted);margin-bottom:8px}

/* ── Training log table ── */
.hprofile-log-table{overflow-x:auto;-webkit-overflow-scrolling:touch;font-size:12px}
.hprofile-log-row{display:grid;grid-template-columns:80px 1fr 70px;gap:6px;padding:6px 0;border-bottom:1px solid var(--cream-dark);align-items:center;min-width:0}
.hprofile-log-row:last-child{border-bottom:none}
.hprofile-log-row span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text)}
.hprofile-log-head span{color:var(--text-muted);font-weight:600;font-size:11px}
/* Upcoming schedule (6 col) */
.hprofile-log-6col-sched .hprofile-log-row{grid-template-columns:68px 46px 1fr 55px 1fr 60px}
/* Training log (8 col) */
.hprofile-log-8col .hprofile-log-row{grid-template-columns:68px 1fr 55px 55px 40px 65px 1fr 60px}
.hprofile-log-manual{background:rgba(255,248,225,0.6)}
.hprofile-log-notes{font-size:11px;color:var(--text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hprofile-type-dot{display:inline-block;width:7px;height:7px;border-radius:50%;margin-right:4px;vertical-align:middle;flex-shrink:0}
.hprofile-manual-tag{font-size:9px;font-weight:700;letter-spacing:0.05em;text-transform:uppercase;color:#8b6914;background:#fff3cd;border-radius:4px;padding:1px 5px;margin-left:5px;vertical-align:middle}

/* ── Health records ── */
.hprofile-health-rec{background:var(--cream-dark);border-radius:8px;padding:9px 11px;margin-bottom:7px}
.hprofile-health-rec-head{display:flex;align-items:center;gap:8px;margin-bottom:4px}
.hprofile-health-type-badge{font-size:10px;font-weight:700;letter-spacing:0.06em;text-transform:uppercase;color:#1565c0;background:#e3f2fd;border-radius:6px;padding:2px 7px}
.hprofile-health-date{font-size:11px;color:var(--text-muted)}
.hprofile-health-provider{font-size:12px;font-weight:500;color:var(--text);margin-bottom:2px}
.hprofile-health-notes{font-size:12px;color:var(--text);line-height:1.4}
.hprofile-health-next{font-size:11px;color:#1e7a3f;margin-top:4px;font-weight:500}

/* ── Photo crop modal ── */
.hcrop-backdrop{position:fixed;inset:0;background:rgba(0,0,0,0.9);z-index:0}
#hcrop-modal{position:fixed;inset:0;z-index:9900;display:flex;align-items:center;justify-content:center;padding:20px}
.hcrop-dialog{position:relative;z-index:1;width:100%;max-width:400px;background:#1a1a1a;border-radius:16px;overflow:hidden}
.hcrop-title{font-size:14px;font-weight:600;color:#fff;text-align:center;padding:16px 16px 10px;letter-spacing:0.04em}
.hcrop-area{width:100%;touch-action:none}
.hcrop-hint{font-size:11px;color:rgba(255,255,255,0.5);text-align:center;padding:8px 16px 6px}
.hcrop-btns{display:flex;gap:10px;padding:10px 16px 16px}
.hcrop-confirm{flex:1;padding:12px;background:var(--primary);color:#fff;border:none;border-radius:24px;font-size:14px;font-weight:600;font-family:inherit;cursor:pointer}
.hcrop-cancel{flex:1;padding:12px;background:rgba(255,255,255,0.12);color:#fff;border:none;border-radius:10px;font-size:14px;font-weight:600;font-family:inherit;cursor:pointer}

/* ── Pending Requests Badge ── */
#pending-req-badge{display:none;background:#c0392b;color:#fff;font-size:10px;font-weight:700;border-radius:10px;padding:1px 6px;min-width:18px;text-align:center;line-height:18px}
/* ── Pending Requests Section ── */
.pending-reqs-card{margin-top:12px}
.pending-req-row{display:flex;align-items:flex-start;gap:10px;padding:12px 16px;border-bottom:1px solid var(--border-light)}
.pending-req-row:last-child{border-bottom:none}
.pending-req-icon{font-size:18px;flex-shrink:0;margin-top:1px}
.pending-req-info{flex:1;min-width:0}
.pending-req-title{font-size:13px;font-weight:600;color:var(--earth);margin-bottom:2px}
.pending-req-meta{font-size:11px;color:var(--text-muted);margin-bottom:1px}
.pending-req-by{font-size:11px;color:var(--text-muted);font-style:italic}
.pending-req-actions{display:flex;flex-direction:column;gap:4px;flex-shrink:0}
.pending-req-approve{background:#2d6a4f;color:#fff;border:none;border-radius:6px;padding:5px 10px;font-size:11px;font-weight:600;cursor:pointer;font-family:inherit}
.pending-req-approve:hover{background:#1e4d38}
.pending-req-reject{background:transparent;color:var(--text-muted);border:1px solid var(--border-light);border-radius:6px;padding:4px 10px;font-size:11px;cursor:pointer;font-family:inherit}
.pending-req-reject:hover{background:#fef2f2;color:#c0392b;border-color:#c0392b}
/* Pending request event block in gcal grid */
.gcal-event-req{border-left:3px dashed;background:transparent!important;border-radius:6px;border-top:1px dashed;border-right:1px dashed;border-bottom:1px dashed}

/* Horse status/flag sheet pill buttons */
.horse-status-opt,.horse-flag-type-opt{font-size:12px;font-weight:600;padding:7px 14px;border-radius:20px;border:1.5px solid var(--sand);background:#fff;color:var(--text);cursor:pointer;font-family:inherit}
.horse-status-opt.active,.horse-flag-type-opt.active{border-color:var(--earth);background:var(--earth);color:#fff}

/* ═══ HORSE PROFILE v2 — CARD LAYOUT ═══ */

/* Page wrapper */
.hprofile-page{padding:12px 16px;display:flex;flex-direction:column;gap:12px}

/* Card */
.hprofile-card{background:var(--paper);border:0.5px solid var(--hair);border-radius:16px;padding:14px 16px}

/* Card title — standalone (has bottom border separator) */
.hprofile-card-title{font-size:11px;font-weight:500;color:var(--text-muted);text-transform:uppercase;letter-spacing:0.04em;margin-bottom:10px;padding-bottom:8px;border-bottom:0.5px solid var(--hair)}

/* Card title row — title + action button side by side (border on the row) */
.hprofile-card-titlerow{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px;padding-bottom:8px;border-bottom:0.5px solid var(--hair)}
.hprofile-card-titlerow .hprofile-card-title{margin-bottom:0;border-bottom:none;padding-bottom:0}

/* ── Compact header ── */
.hprofile2-header{display:flex;align-items:center;justify-content:space-between;gap:12px}
.hprofile2-header-left{display:flex;align-items:center;gap:12px;flex:1;min-width:0}
.hprofile2-avatar-wrap{position:relative;flex-shrink:0}
.hprofile2-avatar{width:56px;height:56px;border-radius:10px;background:var(--cream-dark);overflow:hidden;display:flex;align-items:center;justify-content:center}
.hprofile2-initial{font-family:var(--serif);font-size:28px;color:var(--earth);opacity:0.5;line-height:1;user-select:none}
.hprofile2-name{font-size:18px;font-weight:500;color:var(--earth);line-height:1.2}
.hprofile2-summary{font-size:12px;color:var(--text-muted);margin-top:3px}
.hprofile2-details-btn{background:transparent;color:var(--text-muted);border:1px solid var(--hair-2);border-radius:20px;padding:5px 12px;font-size:11px;cursor:pointer;font-family:var(--sf);white-space:nowrap;flex-shrink:0}
.hprofile2-details-btn:hover{background:var(--ios-fill)}

/* ── Expandable details panel ── */
.hprofile2-details-panel{display:none;margin-top:14px;padding-top:14px;border-top:0.5px solid var(--hair)}
.hprofile2-details-panel.open{display:grid;grid-template-columns:repeat(3,1fr);gap:10px 16px}
@media(max-width:500px){.hprofile2-details-panel.open{grid-template-columns:repeat(2,1fr)}}
.hprofile2-detail-lbl{font-size:11px;color:var(--text-muted)}
.hprofile2-detail-val{font-size:13px;color:var(--text);margin-top:1px;font-weight:500}

/* ── Two-column section layout ── */
.hprofile2-two-col{display:grid;grid-template-columns:1fr 1fr;gap:12px}
@media(max-width:480px){.hprofile2-two-col{grid-template-columns:1fr}}

/* ── Metric cards (3-col) ── */
.hprofile2-metrics{display:grid;grid-template-columns:1fr 1fr 1fr;gap:10px;margin-bottom:14px}
.hprofile2-metric{background:var(--cream-dark);border-radius:10px;padding:10px 12px;text-align:center}
.hprofile2-metric-lbl{font-size:11px;color:var(--text-muted)}
.hprofile2-metric-num{font-family:var(--serif);font-size:22px;font-weight:500;color:var(--earth);margin-top:2px;line-height:1.1}
.hprofile2-metric-num-sm{font-size:14px;font-weight:600;font-family:var(--sf)}

/* ── Two-field row ── */
.hprofile2-field-row{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.hprofile2-field-lbl{font-size:11px;color:var(--text-muted)}
.hprofile2-field-val{font-size:13px;color:var(--text);margin-top:2px;font-weight:500}

/* ── Health items ── */
.hprofile2-health-item{display:flex;align-items:flex-start;gap:10px;padding:8px 0;border-bottom:0.5px solid var(--hair)}
.hprofile2-health-item:last-child{border-bottom:none}
.hprofile2-health-tag{font-size:11px;padding:2px 8px;border-radius:20px;font-weight:500;flex-shrink:0;margin-top:1px;white-space:nowrap}
.hprofile2-health-tag-vet{background:#FCEBEB;color:#A32D2D}
.hprofile2-health-tag-farrier{background:#FAEEDA;color:#854F0B}
.hprofile2-health-tag-vacc{background:#E1F5EE;color:#0F6E56}
.hprofile2-health-tag-deworm{background:#EEEDFE;color:#3C3489}
.hprofile2-health-tag-dental{background:#E6F1FB;color:#185FA5}
.hprofile2-health-tag-other{background:var(--ios-fill);color:var(--text-mid)}
.hprofile2-health-tag-flag{background:#fad5d0;color:#c0392b}
.hprofile2-health-body{flex:1;min-width:0}
.hprofile2-health-date{font-size:13px;font-weight:500;color:var(--text)}
.hprofile2-health-provider{font-size:11px;color:var(--text-muted);margin-top:1px}
.hprofile2-health-notes{font-size:12px;color:var(--text);line-height:1.4;margin-top:2px}
.hprofile2-health-next{font-size:11px;color:#0F6E56;margin-top:3px;font-weight:500}

/* ── Note items ── */
.hprofile2-note{margin-bottom:8px}
.hprofile2-note:last-child{margin-bottom:0}
.hprofile2-note-text{font-size:12px;color:var(--text);line-height:1.5}
.hprofile2-note-meta{font-size:11px;color:var(--text-muted);margin-top:2px}

/* ── Subsection heading inside a card ── */
.hprofile2-subsec-title{font-size:12px;font-weight:600;color:var(--text);margin:14px 0 8px}
.hprofile2-subsec-title:first-child{margin-top:0}
.hprofile2-subsec-titlerow{display:flex;align-items:center;justify-content:space-between;margin:14px 0 8px}
.hprofile2-subsec-titlerow .hprofile2-subsec-title{margin:0}

/* ── Schedule and training log tables ── */
.hprofile2-log-table{overflow-x:auto;-webkit-overflow-scrolling:touch}
.hprofile2-log-head span{font-size:11px;color:var(--text-muted);font-weight:500}
.hprofile2-log-notes{font-size:11px;color:var(--text-muted)}
.hprofile2-sched-row,.hprofile2-sched-head{display:grid;grid-template-columns:72px 44px 90px 60px 1fr 68px;gap:6px;padding:6px 0;border-bottom:0.5px solid var(--hair);align-items:center;font-size:12px}
.hprofile2-sched-row:last-child{border-bottom:none}
.hprofile2-sched-row span,.hprofile2-sched-head span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hprofile2-log-row,.hprofile2-log-head{display:grid;grid-template-columns:68px 88px 55px 50px 38px 58px 1fr;gap:6px;padding:6px 0;border-bottom:0.5px solid var(--hair);align-items:center;font-size:12px}
.hprofile2-log-row:last-child{border-bottom:none}
.hprofile2-log-row span,.hprofile2-log-head span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ── Type tags (schedule/log) ── */
.hprofile2-type-tag{display:inline-block;padding:2px 7px;border-radius:20px;font-size:11px;font-weight:500;white-space:nowrap;vertical-align:middle}
.hprofile2-type-tag-lesson{background:#EEEDFE;color:#3C3489}
.hprofile2-type-tag-arena{background:#E1F5EE;color:#085041}
.hprofile2-type-tag-competition{background:#FAEEDA;color:#633806}
.hprofile2-type-tag-lunge{background:#f0e8ff;color:#5b2d8e}
.hprofile2-type-tag-other{background:var(--ios-fill);color:var(--text-mid)}

/* ── Status labels in schedule ── */
.hprofile2-status-confirmed{font-size:11px;color:#0F6E56}
.hprofile2-status-pending{font-size:11px;color:#854F0B}

/* ── Dev notes grid ── */
.hprofile2-dev-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.hprofile2-dev-item{background:var(--cream-dark);border-radius:10px;padding:10px 12px}

/* ── Action buttons — new hierarchy ── */
.hprofile2-actions{display:flex;flex-wrap:wrap;gap:8px}
.hprofile2-btn-primary{background:var(--primary);color:#fff;border:none;padding:9px 20px;border-radius:24px;font-size:13px;font-weight:600;cursor:pointer;font-family:var(--sf)}
.hprofile2-btn-primary:active{opacity:0.85}
.hprofile2-btn-secondary{background:transparent;color:var(--primary);border:1.5px solid var(--primary);padding:8px 16px;border-radius:24px;font-size:12px;font-weight:500;cursor:pointer;font-family:var(--sf)}
.hprofile2-btn-secondary:active{background:var(--primary-muted)}
.hprofile2-btn-ghost{background:transparent;color:var(--text-muted);border:1px solid var(--hair-2);padding:8px 16px;border-radius:24px;font-size:12px;cursor:pointer;font-family:var(--sf)}
.hprofile2-btn-ghost:active{background:var(--ios-fill)}
