:root {
  font-family: 'Aptos', 'Segoe UI', sans-serif;
  color: #29251f;
  background: #faf4e8;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #29251f;
  --muted: #746650;
  --accent: #8a451b;
  --accent-dark: #633012;
  --cream: #faf4e8;
  --line: #e9dcc5;
  --charcoal: #24251f;
  --amber: #efad48;
  --accent-soft: #f6e8cf;
  --serif: 'Aptos Display', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid #b86a24; outline-offset: 3px; }
.app-shell { min-height: 100vh; }
.auth-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(145deg, #faf4e8, #f6e8cf); }
.auth-card { width: min(100%, 480px); background: #fffaf1; border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: 0 12px 48px #63301214; }
.auth-card > img { display: block; margin: 0 auto 16px; object-fit: contain; }
.auth-card .field { margin-block: 18px; }
.auth-card .muted { font-size: 13px; }
.auth-card input { width: 100%; min-height: 48px; font-size: 16px; }
.auth-card button { min-height: 44px; font-size: 14px; }
.auth-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-block: 16px; }
#auth-message, #cloud-status { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
#continue-device { margin-block: 12px; text-align: left; }
.local-badge { max-width: 360px; }
#storage-status { overflow-wrap: anywhere; }
.sidebar { width: 248px; background: #fffaf1; border-right: 1px solid var(--line); position: fixed; inset: 0 auto 0 0; z-index: 5; display: flex; flex-direction: column; padding: 25px 18px 16px; }
.brand { text-decoration: none; color: var(--ink); display: flex; align-items: center; gap: 11px; padding: 0 5px; }
.brand-mark { width: 48px; height: 48px; flex: none; object-fit: contain; }
.topbar-logo { display: none; width: 40px; height: 40px; object-fit: contain; }
.brand strong { display: block; font: 800 17px Georgia, serif; letter-spacing: -.4px; text-transform: uppercase; }
.brand small { display: block; color: #939087; font-size: 8px; letter-spacing: 1.45px; font-weight: 700; margin-top: 2px; }
.nav-label { color: #aaa79d; font-size: 9px; font-weight: 700; letter-spacing: 1.65px; margin: 43px 9px 11px; }
.primary-nav { display: grid; gap: 5px; }
.nav-item { border: 0; background: transparent; width: 100%; display: flex; align-items: center; gap: 12px; border-radius: 8px; text-align: left; padding: 11px 12px; color: #75736c; font-size: 12px; font-weight: 600; cursor: pointer; transition: background .16s, color .16s; }
.nav-item:hover { background: #f5ebd9; color: var(--accent); }
.nav-item.active { color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.nav-icon { width: 17px; color: #8c9084; display: inline-grid; place-items: center; font-size: 18px; line-height: 1; }
.nav-item.active .nav-icon { color: var(--accent); }
.nav-count { margin-left: auto; font-size: 10px; border-radius: 12px; background: #edd8b4; padding: 2px 7px; color: #75421d; }
.sidebar-bottom { margin-top: auto; }
.farm-card { background: var(--cream); display: flex; align-items: center; gap: 9px; border-radius: 9px; padding: 11px 9px; margin-bottom: 11px; }
.farm-icon { width: 29px; height: 29px; border-radius: 8px; display: grid; place-items: center; background: #ede8dc; color: #766342; font-size: 15px; }
.farm-card strong, .profile-card strong { display: block; font-size: 10px; font-weight: 700; }
.farm-card small, .profile-card small { display: block; font-size: 9px; margin-top: 3px; color: #908e86; }
.farm-more { margin-left: auto; color: #aaa79d; letter-spacing: 1px; }
.settings-link { margin-bottom: 16px; }
.profile-card { border-top: 1px solid #f0efe9; padding: 14px 2px 0; display: flex; align-items: center; gap: 9px; }
.avatar { width: 29px; height: 29px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; font-weight: 700; color: #6f553a; background: #efe3d0; }
.online-dot { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: #98703a; box-shadow: 0 0 0 3px #f6e8cf; }
.main-content { margin-left: 248px; padding: 0 46px 0 48px; max-width: 1550px; }
.topbar { height: 69px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #eeece5; }
.breadcrumb { display: flex; gap: 10px; color: #99968d; font-size: 11px; align-items: center; }
.breadcrumb strong { color: #44423b; font-weight: 600; }
.crumb-separator { color: #c9c6bc; }
.topbar-actions { display: flex; align-items: center; gap: 13px; }
.local-badge { color: #79562b; font-size: 10px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.local-dot { width: 6px; height: 6px; background: #aa712b; border-radius: 50%; }
.icon-button { border: 1px solid #e8e6df; background: #fff; width: 23px; height: 23px; border-radius: 50%; display: grid; place-items: center; color: #88867d; font-size: 11px; cursor: pointer; }
.view { padding-top: 34px; min-height: calc(100vh - 140px); }
.view[hidden], [hidden] { display: none !important; }
.welcome-row, .page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.eyebrow { color: #99968c; letter-spacing: 1.35px; font-weight: 700; font-size: 9px; margin: 0 0 8px; }
h1, h2, p { margin-top: 0; }
h1 { font: 700 28px/1.2 var(--serif); letter-spacing: -.9px; margin-bottom: 7px; color: #302f2a; }
h1 span { color: #bd9860; font-size: 20px; vertical-align: 4px; }
.muted { color: #8c8980; font-size: 11px; line-height: 1.65; margin-bottom: 0; }
.button { min-height: 39px; border: 0; border-radius: 7px; padding: 0 15px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; cursor: pointer; transition: background .16s, transform .16s; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--accent); box-shadow: 0 3px 7px #63301224; }
.button-primary:hover { background: var(--accent-dark); }
.button-danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.button-danger:hover { background: var(--danger-bg); }
.account-danger { margin-top: 24px; border-top: 1px solid var(--rule); padding-top: 16px; overflow-wrap: anywhere; }
.account-danger summary { cursor: pointer; color: var(--danger); font-weight: 700; min-height: 44px; }
.account-danger form { display: grid; gap: 16px; max-width: 520px; }
#load-more-cattle { margin-top: 16px; }
.button-plus { font-size: 18px; line-height: 0; font-weight: 400; }
.button-secondary { background: #f3f2ee; color: #625f57; }
.welcome-row > .button { margin-top: 6px; }
.farm-banner { min-height: 170px; position: relative; overflow: hidden; border-radius: 11px; margin-top: 27px; padding: 25px 27px; color: #fff4dc; background: linear-gradient(115deg, #24251f 20%, #49351e 70%, #99501e); }
.farm-banner::after { content: ''; position: absolute; width: 300px; height: 200px; background: #efad48; opacity: .12; right: 0; top: -95px; border-radius: 50%; }
.farm-banner-copy { position: relative; z-index: 2; }
.banner-label { font-size: 8px; letter-spacing: 1.35px; color: #f4d19a; font-weight: 700; }
.banner-spark { color: #d4b57d; margin-right: 4px; }
.farm-banner h2 { font: 700 22px var(--serif); letter-spacing: -.4px; margin: 12px 0 5px; }
.farm-banner p { color: #f2e1c4; font-size: 10px; margin: 0; }
.pasture-art { position: absolute; right: 16px; top: 10px; bottom: 10px; width: 150px; overflow: hidden; }
.banner-logo { width: 100%; height: 100%; object-fit: contain; }
.farm-banner-copy { max-width: calc(100% - 155px); }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-top: 17px; }
.stat-card { background: #fff; border: 1px solid #eeece6; border-radius: 9px; padding: 14px 15px 13px; min-height: 111px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: #79766e; font-size: 10px; font-weight: 600; }
.stat-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; font-size: 13px; }
.icon-green { color: #7b4b22; background: #f6e8cf; }.icon-sand { color: #89601d; background: #f8ebce; }.icon-brown { color: #8b4b2a; background: #f6e4d7; }.icon-blue { color: #49565e; background: #e7eaeb; }
.stat-value { display: block; font: 700 25px var(--serif); letter-spacing: -.7px; margin: 5px 0 2px; }
.stat-foot { color: #a19e95; font-size: 9px; }
.foot-mark { color: #6e9669; font-size: 11px; font-weight: 700; margin-right: 2px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; margin: 29px 0 12px; }
.section-heading h2 { font: 700 17px var(--serif); letter-spacing: -.35px; margin: 0; }
.section-heading .eyebrow { margin-bottom: 5px; }
.text-button { padding: 4px 0; color: var(--accent); background: transparent; border: 0; font-size: 10px; font-weight: 700; cursor: pointer; }
.text-button span { font-size: 14px; margin-left: 4px; vertical-align: -1px; }
.recent-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.animal-card { min-width: 0; border: 1px solid #eeece6; border-radius: 9px; background: #fff; padding: 12px; display: flex; gap: 11px; align-items: center; cursor: pointer; text-align: left; transition: box-shadow .15s, transform .15s; }
.animal-card:hover, .cattle-row:hover { box-shadow: 0 6px 18px #33311a0c; transform: translateY(-1px); }
.animal-thumb { width: 48px; height: 48px; border-radius: 8px; flex: none; display: grid; place-items: center; font: 700 16px var(--serif); color: #755f43; background: #efe7d9; overflow: hidden; position: relative; }
.animal-thumb::after { content: '✳'; position: absolute; bottom: 2px; right: 5px; color: #a49270; opacity: .55; font-size: 10px; }
.animal-thumb.tone-green { background: #ece4d3; color: #61543c; }.animal-thumb.tone-blue { background: #e4e7e9; color: #48535c; }.animal-thumb.tone-rose { background: #f3dece; color: #8a451b; }.animal-thumb.tone-gold { background: #f4e4be; color: #7b571c; }
.animal-card-copy { min-width: 0; flex: 1; }
.animal-card-copy strong { display: block; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.animal-card-copy small { color: #96938a; font-size: 9px; display: block; }
.animal-card-arrow { color: #aaa79e; font-size: 17px; margin-left: auto; }
.offline-note { display: flex; align-items: center; gap: 10px; color: #746650; font-size: 10px; background: #f6e8cf; border: 1px solid #e9dcc5; border-radius: 8px; padding: 11px 14px; margin-top: 21px; }
.offline-note strong { color: #75421d; }
.offline-note-icon { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; color: #8a451b; background: #edd8b4; font-size: 14px; }
.app-footer { display: flex; justify-content: space-between; border-top: 1px solid #eeece5; padding: 17px 0 18px; color: #aaa79f; font-size: 9px; margin-top: 14px; }
.app-footer > span + span { font-size: 8px; letter-spacing: 1px; font-weight: 700; }
.footer-star { color: #ba9b64; font-size: 11px; margin-left: 3px; }
.page-heading { margin-bottom: 27px; align-items: flex-start; }
.page-heading h1 { margin-bottom: 5px; }
.cattle-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.search-box { flex: 1; display: flex; align-items: center; gap: 9px; background: #fff; border: 1px solid #e8e6df; border-radius: 7px; height: 39px; padding: 0 11px; color: #939087; }
.search-icon { font-size: 20px; line-height: 1; transform: rotate(-20deg); }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; color: #49473f; background: transparent; font-size: 10px; }
.search-box input::placeholder { color: #aaa79e; }
.search-box kbd { border: 1px solid #e8e6df; border-radius: 4px; padding: 1px 5px; font-size: 9px; color: #aaa79e; }
.filter-select select { height: 39px; min-width: 130px; color: #66635b; border: 1px solid #e8e6df; border-radius: 7px; background: #fff; padding: 0 26px 0 11px; font-size: 10px; font-weight: 600; }
.result-line { display: flex; justify-content: space-between; align-items: center; font-size: 9px; color: #97948b; padding-bottom: 9px; }
.sort-label { color: #77746c; }.sort-label span { margin-left: 5px; }
.cattle-list { display: grid; gap: 8px; }
.cattle-row { width: 100%; display: flex; align-items: center; gap: 13px; min-width: 0; border: 1px solid #eeece6; border-radius: 9px; background: #fff; padding: 10px 14px; text-align: left; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.cattle-row .animal-thumb { width: 45px; height: 45px; }
.cattle-main { flex: 1; min-width: 0; }
.cattle-name { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 4px; }
.cattle-name strong { font-size: 11px; }
.cattle-name .animal-id { font-size: 9px; color: #a09d94; }
.cattle-meta { display: flex; gap: 12px; flex-wrap: wrap; color: #8c8980; font-size: 9px; }
.cattle-meta span + span::before { content: '·'; margin-right: 12px; color: #cfccc2; }
.status-pill { padding: 4px 8px; border-radius: 20px; font-size: 8px; font-weight: 700; text-transform: capitalize; white-space: nowrap; }
.status-active { color: #51744e; background: #edf3e9; }.status-pregnant { color: #80673e; background: #f6f0e1; }.status-sold { color: #72706b; background: #f0efeb; }.status-deceased { color: #896a62; background: #f5ece8; }.status-archived { color: #777879; background: #eceef0; }
.row-arrow { color: #aaa79e; font-size: 19px; margin-left: 4px; }
.empty-state { text-align: center; padding: 65px 20px; border: 1px dashed #dedbd0; border-radius: 10px; background: #fff; }
.empty-icon { font-size: 28px; color: #718469; }
.empty-state h2 { font: 700 18px var(--serif); margin: 10px 0 5px; }.empty-state p { color: #8c8980; font-size: 11px; margin: 0 0 18px; }
.coming-card { background: #fff; border: 1px solid #eeece6; border-radius: 11px; padding: 28px; display: flex; align-items: flex-start; gap: 18px; position: relative; overflow: hidden; }
.coming-icon { width: 40px; height: 40px; display: grid; place-items: center; background: #eef3ea; color: #557250; border-radius: 10px; font-size: 20px; flex: none; }
.coming-card h2 { font: 700 20px var(--serif); margin: 0 0 7px; }.coming-card p:not(.eyebrow) { color: #8c8980; max-width: 430px; font-size: 11px; line-height: 1.7; margin-bottom: 11px; }.coming-card .eyebrow { margin: 3px 0 9px; }
.coming-illustration { position: absolute; right: 34px; top: 24px; font-size: 83px; color: #f0eee4; }
.settings-card { display: flex; align-items: center; gap: 15px; background: #fff; border: 1px solid #eeece6; border-radius: 9px; padding: 16px; margin-bottom: 11px; }
.settings-icon { width: 35px; height: 35px; border-radius: 9px; background: #f4eee2; color: #8b7046; display: grid; place-items: center; font-size: 17px; flex: none; }.settings-icon-green { color: var(--accent); background: var(--accent-soft); }
.settings-copy { flex: 1; }.settings-copy h2 { font: 700 12px var(--serif); margin: 0 0 4px; }.settings-copy p { color: #8c8980; font-size: 10px; line-height: 1.6; margin: 0; max-width: 580px; }
.settings-state { color: #688166; font-size: 8px; font-weight: 700; letter-spacing: .7px; white-space: nowrap; }
.settings-footer { padding: 15px 2px; color: #aaa79f; font-size: 9px; }.settings-footer span { margin: 0 5px; }
.animal-dialog, .profile-dialog { border: 1px solid #eeece5; border-radius: 12px; padding: 0; width: min(540px, calc(100vw - 28px)); max-height: min(90vh, 780px); box-shadow: 0 20px 60px #29271930; color: var(--ink); }
.animal-dialog::backdrop, .profile-dialog::backdrop { background: #24271f73; backdrop-filter: blur(2px); }
.animal-dialog form { padding: 25px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.dialog-heading h2 { font: 700 21px var(--serif); margin: 0 0 5px; }.dialog-heading .muted { max-width: 410px; font-size: 10px; }
.close-button { border: 0; border-radius: 7px; background: #f4f3ef; color: #76736b; width: 30px; height: 30px; font-size: 22px; line-height: 1; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px 12px; }
.field { display: grid; gap: 6px; min-width: 0; color: #615e56; font-size: 10px; font-weight: 600; }
.field-wide { grid-column: 1 / -1; }.field b { color: #a55c49; }.field small { color: #aaa69c; font-size: 8px; letter-spacing: .7px; margin-left: 3px; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #e9e7e0; border-radius: 6px; min-height: 37px; padding: 8px 10px; background: #fff; color: #3c3a34; font-size: 10px; font-weight: 400; }
.field textarea { resize: vertical; min-height: 69px; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder { color: #b1aea5; }
.form-error { color: #8c4238; background: #fbefeb; border: 1px solid #f1dbd4; padding: 9px 11px; border-radius: 6px; font-size: 10px; line-height: 1.5; margin: -7px 0 13px; }
.form-footnote { display: flex; gap: 7px; color: #72836b; font-size: 9px; margin: 14px 0 17px; align-items: center; }.form-footnote span { font-size: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; border-top: 1px solid #efeee9; padding-top: 14px; }
.profile-dialog { width: min(480px, calc(100vw - 28px)); }
.profile-cover { height: 105px; background: linear-gradient(115deg, #24251f, #99501e); position: relative; overflow: hidden; }
.profile-cover::before, .profile-cover::after { content: ''; position: absolute; border-radius: 50%; background: #a36d2e; width: 240px; height: 130px; bottom: -92px; right: -30px; }.profile-cover::after { background: #d69a45; width: 210px; right: 70px; bottom: -106px; }
.profile-close { position: absolute; top: 12px; right: 13px; z-index: 2; background: #ffffff28; color: #fff; }
.profile-body { padding: 0 24px 23px; }
.profile-avatar { width: 59px; height: 59px; border-radius: 11px; border: 4px solid #fff; margin-top: -30px; position: relative; display: grid; place-items: center; font: 700 20px var(--serif); color: #715d40; background: #eee5d6; }
.profile-title-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0 4px; }
.profile-title-line h2 { font: 700 21px var(--serif); margin: 0; }.profile-id { color: #96938a; font-size: 10px; }
.profile-subline { color: #88857c; font-size: 10px; margin-bottom: 17px; }
.profile-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); border-top: 1px solid #efeee9; }
.profile-field { padding: 12px 4px 9px 0; border-bottom: 1px solid #efeee9; min-width: 0; }
.profile-field span { display: block; color: #a09d94; font-size: 8px; letter-spacing: .7px; text-transform: uppercase; margin-bottom: 4px; }
.profile-field strong { font-size: 10px; font-weight: 600; overflow-wrap: anywhere; }
.profile-notes { background: #f7f6f1; border-radius: 7px; padding: 11px; margin-top: 14px; color: #77736a; font-size: 10px; line-height: 1.6; }
.profile-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.profile-section { margin-top: 20px; }
.profile-section-heading { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 9px; }
.profile-section-heading .eyebrow { margin: 0 8px 0 0; }
.profile-section-heading h3 { font: 700 13px var(--serif); margin: 0 auto 0 0; }
.offspring-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 7px; }
.offspring-link { border: 1px solid #eeece6; background: #fff; padding: 7px; display: flex; gap: 8px; align-items: center; border-radius: 7px; text-align: left; cursor: pointer; }
.offspring-link .animal-thumb { width: 34px; height: 34px; font-size: 12px; }
.offspring-link > span:nth-child(2) { flex: 1; min-width: 0; }
.offspring-link strong, .offspring-link small { display: block; font-size: 9px; }
.offspring-link small { color: #96938a; margin-top: 2px; }
.timeline { display: grid; }
.timeline-entry { display: flex; align-items: center; gap: 9px; padding: 9px 0; border-top: 1px solid #efeee9; min-width: 0; }
.timeline-marker { width: 24px; height: 24px; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); border-radius: 50%; font-size: 12px; }
.timeline-copy { flex: 1; min-width: 0; }
.timeline-copy strong, .timeline-copy small { display: block; }
.timeline-copy strong { font-size: 10px; margin-bottom: 3px; }
.timeline-copy small { color: #8c8980; font-size: 9px; line-height: 1.5; }
.timeline-reminder { text-align: right; flex: none; }
.timeline-empty { color: #99958c; font-size: 10px; padding: 12px 0; border-top: 1px solid #efeee9; }
.upcoming-heading { margin-top: 22px; }
.upcoming-list, .calendar-list { display: grid; gap: 7px; }
.reminder-card { display: flex; gap: 10px; align-items: center; min-width: 0; background: #fff; border: 1px solid #eeece6; border-radius: 8px; padding: 9px 11px; }
.reminder-calendar-icon { width: 31px; height: 31px; display: grid; flex: none; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 15px; }
.reminder-copy { flex: 1; min-width: 0; }
.reminder-copy strong, .reminder-copy small, .reminder-date strong, .reminder-date small { display: block; }
.reminder-copy strong, .reminder-date strong { font-size: 10px; }
.reminder-copy small, .reminder-date small { margin-top: 3px; font-size: 8px; color: #96938a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reminder-date { text-align: right; min-width: 76px; }
.reminder-date small { color: #79562b; }
.reminder-overdue { border-color: #eadbd4; background: #fffdfc; }
.reminder-overdue .reminder-calendar-icon { color: #976453; background: #f5ece7; }
.reminder-overdue .reminder-date small { color: #98604e; font-weight: 700; }
.reminders-empty { display: flex; align-items: center; gap: 10px; background: #f6e8cf; border: 1px solid var(--line); border-radius: 8px; padding: 12px; color: #746650; font-size: 9px; line-height: 1.5; }
.reminders-empty > span:first-child { color: #8a451b; font-size: 15px; }
.reminders-empty strong { color: #75421d; }
.calendar-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 11px; margin: 2px 0 18px; }
.calendar-stat { background: #fff; border: 1px solid #eeece6; border-radius: 9px; padding: 12px 14px; }
.calendar-stat span { display: block; color: #848178; font-size: 10px; }
.calendar-stat strong { display: block; margin-top: 5px; font: 700 21px var(--serif); }
.calendar-stat-overdue strong { color: #98604e; }
.calendar-empty { margin-top: 4px; }
.reminder-done { min-height: 30px; padding: 0 9px; font-size: 9px; flex: none; }
.export-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 14px; }
.toast { position: fixed; z-index: 20; bottom: 22px; left: 50%; transform: translateX(-50%); padding: 11px 17px; color: #fff4dc; background: var(--charcoal); border-radius: 7px; box-shadow: 0 5px 20px #1b251f32; font-size: 11px; max-width: calc(100vw - 30px); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.mobile-nav { display: none; }

@media (min-width: 1440px) { .main-content { margin-right: auto; } }
@media (max-width: 1100px) {
  .main-content { padding-left: 30px; padding-right: 30px; }
  .sidebar { width: 220px; }.main-content { margin-left: 220px; }
  .stats-grid { gap: 9px; }.stat-card { padding: 12px; }.recent-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 960px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 0 20px 83px; }
  .topbar { height: 58px; }.topbar-actions { gap: 0; }.topbar-actions .icon-button { display: none; }
  .topbar-logo { display: block; margin-right: 2px; }
  .view { padding-top: 25px; min-height: calc(100vh - 140px); }
  h1 { font-size: 25px; }
  .farm-banner { margin-top: 21px; min-height: 147px; padding: 22px 20px; }
  .pasture-art { width: 110px; right: 10px; }.farm-banner-copy { max-width: calc(100% - 110px); }
  .farm-banner h2 { font-size: 20px; }.farm-banner p { max-width: 200px; line-height: 1.5; }
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin-top: 12px; }.stat-card { min-height: 99px; padding: 11px 12px; }
  .stat-value { font-size: 23px; }.stat-foot { font-size: 8px; }
  .section-heading { margin-top: 23px; }.recent-grid { grid-template-columns: 1fr; gap: 8px; }.animal-card { padding: 9px 10px; }.animal-thumb { width: 42px; height: 42px; }
  .offline-note { align-items: flex-start; line-height: 1.55; font-size: 9px; }
  .app-footer { margin-top: 10px; font-size: 8px; }
  .mobile-nav { display: flex; position: fixed; z-index: 10; bottom: 0; inset-inline: 0; justify-content: space-around; background: #fff; border-top: 1px solid #eceae3; padding: 7px 6px calc(7px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 12px #2d2a1910; }
  .mobile-nav .nav-item { display: grid; justify-items: center; align-content: center; gap: 3px; width: 25%; padding: 4px 0; color: #8c8980; font-size: 8px; }
  .mobile-nav .nav-icon { font-size: 18px; }.mobile-nav .nav-item.active { background: transparent; color: var(--accent); }
  .welcome-row { align-items: flex-start; }.welcome-row > .button { padding: 0 11px; min-height: 36px; font-size: 10px; white-space: nowrap; }.welcome-copy { max-width: 225px; }
  .page-heading { gap: 10px; }.page-heading .button { padding: 0 10px; font-size: 10px; min-height: 35px; white-space: nowrap; }
  .cattle-row { gap: 9px; padding: 9px; }.cattle-row .animal-thumb { width: 40px; height: 40px; }
  .cattle-meta { gap: 6px; }.cattle-meta span + span::before { margin-right: 6px; }.cattle-meta span { font-size: 8px; }
  .status-pill { padding: 4px 6px; font-size: 7px; }.row-arrow { display: none; }
  .filter-select select { min-width: 110px; padding-left: 8px; padding-right: 17px; font-size: 9px; }
  .cattle-toolbar { gap: 6px; }.search-box { padding: 0 8px; }.search-box kbd { display: none; }
  .coming-card { padding: 19px 15px; gap: 12px; }.coming-icon { width: 34px; height: 34px; }.coming-card h2 { font-size: 17px; }.coming-illustration { right: 15px; top: 12px; font-size: 55px; }
  .settings-card { gap: 10px; padding: 12px; }.settings-state { font-size: 7px; }.settings-copy p { font-size: 9px; }.settings-copy h2 { font-size: 11px; }
  .export-actions { flex-direction: column; gap: 6px; align-items: flex-end; }.reminder-card { gap: 7px; padding: 8px; }.reminder-date { min-width: 63px; }.reminder-done { padding-inline: 6px; }
}
@media (max-width: 390px) {
  .main-content { padding-inline: 14px; }.welcome-row { gap: 8px; }.welcome-row h1 { font-size: 21px; }.welcome-row > .button { font-size: 9px; }.farm-banner { padding-left: 16px; }.farm-banner p { max-width: 178px; font-size: 9px; }.pasture-art { width: 95px; }
  .cattle-name { gap: 5px; }.cattle-name strong { font-size: 10px; }.cattle-row .animal-thumb { width: 35px; height: 35px; }.status-pill { font-size: 6px; }.form-grid { column-gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }

/* Subscription */
.settings-icon-gold { color: #a07a2c; background: #f6eedb; }
.settings-state-pro { color: #9a7428; }
.herd-limit-note { color: #8b7046; font-weight: 700; }
.paywall-dialog { border: 1px solid #eeece5; border-radius: 16px; padding: 0; width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: 0 20px 60px #29271930; color: var(--ink); background: #fffdf8; }
.paywall-dialog::backdrop { background: #24271f80; backdrop-filter: blur(2px); }
.paywall { position: relative; padding: 26px 24px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.paywall-close { position: absolute; top: 12px; right: 12px; }
.paywall-logo { width: 112px; height: 112px; object-fit: contain; margin-bottom: 4px; }
.paywall h2 { font: 800 21px var(--serif); letter-spacing: -.4px; margin: 0 0 6px; }
.paywall .muted { margin: 0 0 14px; }
.paywall-benefits { list-style: none; padding: 0; margin: 0 0 16px; text-align: left; display: grid; gap: 9px; font-size: 12px; width: 100%; }
.paywall-benefits li { display: flex; gap: 10px; align-items: flex-start; }
.paywall-benefits li span { flex: none; width: 19px; height: 19px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.paywall-price { width: 100%; border: 1.5px solid #c9b78f; background: #fbf6ea; border-radius: 11px; padding: 11px; display: grid; gap: 3px; margin-bottom: 14px; }
.paywall-price strong { font: 800 18px var(--serif); }
.paywall-price small { color: #7c7a72; font-size: 10px; }
.paywall-price .paywall-trial { color: var(--accent); font-weight: 700; }
.paywall-subscribe { width: 100%; min-height: 46px; font-size: 13px; }
.paywall-subscribe:disabled { opacity: .6; cursor: default; }
.paywall-restore { margin-top: 10px; font-size: 11px; }
.paywall-unavailable, .paywall-web-note { font-size: 11px; color: #8b5d3f; margin: 10px 0 0; line-height: 1.5; }
.paywall-web-note { color: #5d5a52; }
.paywall-terms { font-size: 9px; line-height: 1.55; color: #8d8a81; margin: 12px 0 6px; }
.paywall-links { font-size: 10px; display: flex; gap: 8px; justify-content: center; margin: 0; }
.paywall-links a, a.text-button { color: var(--accent); font-weight: 700; text-decoration: none; }

@media (max-width: 960px) {
  .main-content { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
  .button, .welcome-row > .button, .page-heading .button, .reminder-done,
  .mobile-nav .nav-item, .text-button, .close-button { min-height: 44px; }
  .close-button { min-width: 44px; }
  .text-button { display: inline-flex; align-items: center; }
  .field input, .field select, .field textarea, .search-box input, .filter-select select { font-size: 16px; min-width: 0; }
  .field input, .field select, .filter-select select { min-height: 44px; }
  .mobile-nav .nav-item { font-size: 11px; }
  .settings-copy p, .muted, .reminder-copy small, .reminder-date small { font-size: 12px; }
  .reminder-copy strong, .reminder-date strong, .settings-copy h2 { font-size: 13px; }
  .reminder-card, .settings-card { flex-wrap: wrap; }
  .dialog-heading > div { min-width: 0; }
  .close-button { flex-shrink: 0; }
}

@media (max-width: 480px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .animal-dialog form { padding: 18px; }
}

.animal-photo { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.photo-preview { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; }
.report-filters { margin: 20px 0; max-width: 720px; }
.report-actions, .task-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.report-preview { overflow-x: auto; margin-top: 20px; background: #fff; padding: 16px; border-radius: 8px; }
.report-preview:empty { display: none; }
.report-preview h1 { font-size: 22px; }
.report-preview h2 { font-size: 18px; }
.report-preview p { font-size: 13px; line-height: 1.5; }
.report-preview table { border-collapse: collapse; width: 100%; min-width: 850px; font-size: 12px; }
.report-preview td, .report-preview th { border: 1px solid #ccc; text-align: left; padding: 8px; vertical-align: top; overflow-wrap: anywhere; max-width: 350px; }
.task-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.task-card p { margin: 6px 0; font-size: 13px; }
.task-card > div { min-width: 0; overflow-wrap: anywhere; }
.batch-content { padding: 20px; }
.batch-choice { display: flex; gap: 12px; align-items: center; min-height: 48px; font-size: 14px; padding-block: 8px; border-bottom: 1px solid var(--line); }
.batch-choice input { width: 24px; height: 24px; flex-shrink: 0; }
.timeline-filter { margin-bottom: 10px; }
.paywall-plan { width: 100%; margin-bottom: 12px; text-align: left; }
.profile-actions { flex-wrap: wrap; }
.account-farm-card { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 20px; margin-bottom: 16px; }
.account-farm-card h2 { font-size: 20px; }
.account-farm-card > .muted { margin-bottom: 16px; font-size: 13px; }
.account-farm-card .form-grid { margin-top: 20px; }
.account-farm-card .dialog-actions { flex-wrap: wrap; margin-block: 16px; }
.migration-details { margin-block: 16px; color: #746650; font-size: 13px; }
.migration-details summary { cursor: pointer; min-height: 44px; display: list-item; align-content: center; }
.migration-details code { overflow-wrap: anywhere; }

@media (max-width: 960px) {
  .mobile-nav .nav-item { width: 20%; }
  .timeline-entry { flex-wrap: wrap; }
  .timeline-copy { flex-basis: 65%; }
  .timeline-copy strong, .profile-field strong { font-size: 13px; }
  .timeline-copy small, .profile-field span, .profile-notes, .cattle-meta span { font-size: 12px; }
  .cattle-name strong { font-size: 14px; }
  .status-pill { font-size: 10px; }
  .cattle-row { flex-wrap: wrap; }
  .settings-copy { min-width: 180px; }
}

@media (max-width: 960px) {
  html { -webkit-text-size-adjust: 100%; }
  body { min-height: 100dvh; }
  .main-content {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .topbar { height: auto; min-height: 58px; padding-top: env(safe-area-inset-top); gap: 8px; }
  .breadcrumb { min-width: 0; flex-wrap: wrap; gap: 6px; }
  .local-badge { font-size: 11px; }
  .button, .text-button { font-size: 14px; }
  .welcome-row, .page-heading { flex-wrap: wrap; }
  .welcome-row > .button, .page-heading .button { font-size: 14px; }
  .field, .form-error, .form-footnote { font-size: 13px; }
  .field small { font-size: 11px; letter-spacing: 0; }
  .dialog-heading .muted { font-size: 12px; }
  .animal-dialog, .profile-dialog {
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }
  .field input, .field textarea { scroll-margin-block: 80px; }
  .welcome-copy { max-width: none; }
  .banner-label, .eyebrow { font-size: 11px; }
  .farm-banner p, .stat-foot, .offline-note, .empty-state p { font-size: 12px; }
  .stat-top, .profile-id, .profile-subline, .calendar-stat span { font-size: 13px; }
  .cattle-toolbar { flex-wrap: wrap; }
  .search-box { flex-basis: 100%; min-height: 48px; }
  .filter-select { width: 100%; }
  .filter-select select { width: 100%; }
  .settings-card { align-items: flex-start; }
  .settings-copy { min-width: 0; flex-basis: calc(100% - 50px); }
  .settings-copy p, .settings-copy h2 { font-size: 14px; }
  .settings-state { font-size: 11px; white-space: normal; }
  .export-actions { width: 100%; align-items: stretch; gap: 8px; }
  .export-actions .text-button { justify-content: flex-start; }
  .task-actions { width: 100%; gap: 8px; }
  .task-actions .button { flex: 1 1 90px; }
  .batch-choice { overflow-wrap: anywhere; }
  .report-preview { max-width: 100%; -webkit-overflow-scrolling: touch; }
  .profile-title-line h2, .farm-banner h2, .batch-choice { overflow-wrap: anywhere; }
  .mobile-nav { padding-left: max(6px, env(safe-area-inset-left)); padding-right: max(6px, env(safe-area-inset-right)); }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); font-size: 14px; }
}

@media print {
  body.printing-report .sidebar, body.printing-report .topbar, body.printing-report .mobile-nav,
  body.printing-report .app-footer, body.printing-report .report-filters,
  body.printing-report .report-actions, body.printing-report #view-reports > .page-heading,
  body.printing-report .toast, body.printing-report #report-error { display: none !important; }
  body.printing-report .main-content { margin: 0; padding: 0; }
  body.printing-report #view-reports { padding: 0; min-height: 0; }
  body.printing-report .report-preview { overflow: visible; padding: 0; }
  body.printing-report .report-preview table { min-width: 0; font-size: 8pt; table-layout: fixed; }
  body.printing-report .report-preview td, body.printing-report .report-preview th { padding: 4px; overflow-wrap: anywhere; }
  body.printing-report thead { display: table-header-group; }
  @page { size: landscape; margin: 12mm; }
}

/* ===== Ranch ledger refinement (original implementation; no third-party snippets) ===== */
:root {
  --paper: #f5f6f5; --card: #ffffff; --rule: #d6dcd8; --rule-soft: #e9edeb; --text-2: #414d46; --text-3: #5c6861;
  --ink: #202c25; --accent: #315b43; --accent-dark: #244432; --accent-soft: #edf3ef; --amber: #9bb6a2;
  --serif: 'Segoe UI', 'Aptos', system-ui, -apple-system, Roboto, sans-serif;
  --sans: 'Segoe UI', 'Aptos', system-ui, -apple-system, Roboto, sans-serif;
  --danger: #8c2f22; --danger-bg: #fbece8; --ok: #3f6b3a; --ok-bg: #edf3e8;
  --radius: 8px; --focus: #1f5f8b;
}
:root, body { font-family: var(--sans); color: var(--ink); background: var(--paper); }
.domain-notice { position: relative; z-index: 6; margin-left: 256px; padding: 14px 20px; border-bottom: 1px solid var(--rule); background: var(--accent-soft); color: var(--ink); font-size: 14px; overflow-wrap: anywhere; }
.domain-notice a { color: var(--accent-dark); font-weight: 700; }
body { font-size: 15px; line-height: 1.5; font-variant-numeric: tabular-nums; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.search-box:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.search-box input:focus-visible { outline: 0; }

/* Type */
h1, h2, h3, .brand strong, .stat-value, .calendar-stat strong, .farm-banner h2 { font-family: var(--serif); font-weight: 700; color: var(--ink); }
h1 { font-size: 32px; letter-spacing: -.5px; line-height: 1.15; }
.eyebrow, .nav-label, .banner-label { font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: .12em; color: var(--text-3); text-transform: uppercase; }
.muted { font-size: 14px; line-height: 1.6; color: var(--text-3); }
.section-heading h2 { font-size: 22px; }
.section-heading { border-top: 2px solid var(--ink); padding-top: 14px; margin-top: 36px; }

/* Buttons */
.button { min-height: 44px; border-radius: var(--radius); padding: 0 20px; font-size: 14px; font-weight: 700; letter-spacing: .01em; box-shadow: none; transition: background-color .15s, border-color .15s, color .15s; }
.button:hover { transform: none; }
.button-primary { background: var(--accent); color: #fff; border: 1px solid var(--accent-dark); }
.button-primary:hover { background: var(--accent-dark); }
.button-secondary { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.button-secondary:hover { background: var(--accent-soft); border-color: var(--accent); }
.button:disabled, .button[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.text-button { min-height: 44px; display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 700; color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #c9a878; padding: 0 4px; }
.text-button:hover { text-decoration-color: currentColor; }
.icon-button { width: 44px; height: 44px; font-size: 16px; background: transparent; border-color: var(--rule); color: var(--text-2); }
.close-button { width: 44px; height: 44px; border: 1px solid var(--rule); background: transparent; }

/* Fields */
.field { font-size: 14px; font-weight: 600; color: var(--ink); gap: 7px; }
.field input, .field select, .field textarea { min-height: 44px; font-size: 16px; border: 1px solid #b9a77f; border-radius: 6px; background: #fff; color: var(--ink); padding: 9px 12px; transition: border-color .15s, box-shadow .15s; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--accent); }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { border-color: var(--focus); outline: 3px solid #1f5f8b55; outline-offset: 0; }
.field input[aria-invalid="true"], .field input:user-invalid { border-color: var(--danger); }
.field input::placeholder, .field textarea::placeholder { color: #7d725c; }
.field b { color: var(--danger); }
.field small { font-size: 12px; letter-spacing: 0; color: var(--text-3); }
.form-error { color: var(--danger); background: var(--danger-bg); border: 1px solid #e4b9af; border-left: 4px solid var(--danger); border-radius: 6px; font-size: 14px; padding: 10px 12px; margin: 0 0 14px; }

/* Auth: welcome / sign in / reset */
.auth-screen { background: var(--paper); padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); align-items: start; }
.auth-card { margin-block: auto; width: min(100%, 460px); background: var(--card); border: 1px solid var(--rule); border-radius: 8px; padding: 32px 32px 26px; box-shadow: none; position: relative; }
.auth-card > img { width: 72px; height: 72px; margin: 0 0 14px; }
.auth-card .eyebrow { margin-bottom: 6px; }
.auth-card h1 { font-size: 30px; margin-bottom: 10px; }
.auth-card #auth-intro { font-size: 15px; color: var(--text-2); margin-bottom: 18px; }
.auth-card .muted { font-size: 13px; line-height: 1.55; }
.auth-card .field { margin-block: 14px; }
.auth-card input { min-height: 48px; }
.auth-card form { border-top: 1px solid var(--rule); margin-top: 6px; padding-top: 4px; }
.auth-card .auth-hint { background: var(--accent-soft); border-radius: 6px; padding: 10px 12px; color: var(--text-2); }
#auth-message { margin: 0 0 14px; padding: 10px 12px; border-radius: 6px; background: var(--paper); border: 1px solid var(--rule); color: var(--text-2); font-size: 14px; }
#auth-message:empty { display: none; }
#auth-message.form-error { color: var(--danger); background: var(--danger-bg); border-color: #e4b9af; border-left: 4px solid var(--danger); }
.auth-actions { gap: 10px; margin-block: 14px; align-items: center; }
.auth-actions .button { flex: 1 1 150px; }
.auth-actions .text-button { flex: 0 1 auto; }
#new-password-form > .button { width: 100%; }
.auth-card button { min-height: 44px; font-size: 14px; }
#continue-device { display: flex; width: 100%; justify-content: center; border: 1px dashed #b9a77f; border-radius: var(--radius); margin-block: 8px 14px; text-decoration: none; }
#continue-device:hover { background: var(--accent-soft); }
.auth-card > p:last-child { border-top: 1px solid var(--rule); padding-top: 14px; margin-top: 8px; }
.auth-card a { color: var(--accent-dark); font-weight: 600; }

/* Sidebar */
.sidebar { background: #25352c; border-right: 0; color: #e7eeea; width: 256px; padding: 24px 16px 16px; }
.main-content { margin-left: 256px; }
.brand { color: #fbf3df; }
.brand strong { font-size: 18px; letter-spacing: 0; color: #f5f8f6; text-transform: none; font-family: var(--sans); }
.brand small { font-size: 12px; letter-spacing: 0; color: #b8c9be; font-weight: 400; }
.nav-label { color: #b8c9be; margin: 32px 10px 10px; }
.nav-item { min-height: 44px; font-size: 15px; font-weight: 600; color: #dfe8e2; border-radius: 6px; border-left: 3px solid transparent; }
.nav-item:hover { background: #344b3d; color: #fff; }
.nav-item.active { background: #344b3d; color: #fff; border-left-color: var(--amber); }
.nav-icon { color: inherit; width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-item.active .nav-icon { color: var(--amber); }
.nav-count { background: #c8d9cd; color: #25352c; font-size: 12px; font-weight: 700; padding: 1px 8px; }
.farm-card { background: #2c4033; border: 1px solid #405849; border-radius: 6px; padding: 10px; }
.farm-icon { display: none; }
.farm-card strong, .profile-card strong { font-size: 13px; color: #fbf3df; }
.farm-card small, .profile-card small { font-size: 12px; color: #b8c9be; }
.farm-more { display: none; }
.profile-card { border-top: 1px solid #405849; }
.avatar { width: 34px; height: 34px; font-size: 12px; background: #c8d9cd; color: #25352c; }
.online-dot { background: #8fc27f; box-shadow: 0 0 0 3px #3a4a35; }

/* Top bar & status */
.topbar { height: 72px; border-bottom: 1px solid var(--rule); }
.breadcrumb { font-size: 14px; color: var(--text-3); }
.breadcrumb strong { color: var(--ink); font-weight: 700; }
.crumb-separator { color: #a99a78; }
.local-badge { font-size: 13px; color: var(--text-2); background: var(--card); border: 1px solid var(--rule); border-radius: 999px; padding: 6px 12px; max-width: min(420px, 100%); }
.local-dot { width: 8px; height: 8px; background: var(--ok); }
.local-badge:has(#storage-status.error, #storage-status.form-error) { border-color: #e4b9af; background: var(--danger-bg); color: var(--danger); }
#cloud-status { margin: 0 0 14px; padding: 10px 12px; border-radius: 6px; background: var(--paper); border: 1px solid var(--rule); color: var(--text-2); font-size: 14px; }
#cloud-status:empty { display: none; }
#cloud-status.form-error { color: var(--danger); background: var(--danger-bg); border-color: #e4b9af; border-left: 4px solid var(--danger); }

/* Overview */
.view { padding-top: 32px; }
.welcome-row h1 { font-size: 34px; }
.welcome-copy { font-size: 15px; }
.farm-banner { background: #2a251c; border-radius: 6px; border-bottom: 5px solid var(--amber); padding: 28px 30px; min-height: 160px; }
.farm-banner::after { display: none; }
.farm-banner { min-height: 0; padding: 16px 20px; background: var(--card); border: 1px solid var(--rule); border-radius: 6px; }
.farm-banner-copy { max-width: 100%; }
.banner-label { color: var(--text-3); font-size: 12px; }
.farm-banner h2 { color: var(--ink); font-size: 22px; margin: 4px 0 0; letter-spacing: -.3px; }
.farm-banner p { font-size: 15px; color: #eadcc0; }
.pasture-art { opacity: .95; }
.stats-grid { gap: 0; margin-top: 20px; background: var(--card); border: 1px solid var(--rule); border-radius: 6px; }
.stat-card { background: transparent; border: 0; border-right: 1px solid var(--rule); border-radius: 0; padding: 18px 20px; min-height: 120px; }
.stat-card:last-child { border-right: 0; }
.stat-top { font-size: 13px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.stat-icon { width: 28px; height: 28px; border-radius: 50%; font-size: 14px; }
.stat-value { font-size: 38px; letter-spacing: -1px; margin: 8px 0 2px; line-height: 1.1; }
.stat-foot { font-size: 13px; color: var(--text-3); }
.foot-mark { color: var(--ok); }

/* Lists & cards */
.animal-card, .cattle-row, .reminder-card, .settings-card, .calendar-stat, .task-card, .account-farm-card, .coming-card, .empty-state { background: var(--card); border: 1px solid var(--rule); border-radius: 6px; }
.animal-card:hover, .cattle-row:hover { box-shadow: 0 4px 14px #4a2f1214; transform: none; border-color: #c4b189; }
.animal-card, .cattle-row { min-height: 64px; }
.animal-thumb { border-radius: 6px; font-size: 17px; width: 48px; height: 48px; }
.animal-thumb::after { display: none; }
.animal-card-copy strong, .cattle-name strong { font-size: 15px; font-weight: 700; }
.animal-card-copy small, .cattle-meta, .cattle-meta span, .cattle-name .animal-id { font-size: 13px; color: var(--text-3); }
.animal-card-arrow, .row-arrow { color: #8a7c5e; }
.status-pill { font-size: 12px; padding: 3px 10px; border: 1px solid transparent; font-weight: 700; }
.status-active { color: #2f5a2b; background: var(--ok-bg); border-color: #cfe0c8; }
.status-pregnant { color: #70541f; background: #f7edd4; border-color: #e6d4a6; }
.status-sold { color: #55524a; background: #efece4; border-color: #dcd7c9; }
.status-deceased { color: #7a3d33; background: #f6e8e4; border-color: #e6cbc4; }
.status-archived { color: #4d5358; background: #eceef0; border-color: #d5d9dc; }
.offline-note { font-size: 14px; background: var(--accent-soft); border: 1px solid var(--rule); border-left: 4px solid var(--amber); border-radius: 6px; line-height: 1.6; }
.offline-note-icon { display: none; }
.app-footer { font-size: 13px; color: var(--text-3); border-top: 1px solid var(--rule); }
.app-footer > span + span { font-size: 12px; letter-spacing: .1em; }
.page-heading { border-bottom: 2px solid var(--ink); padding-bottom: 18px; }
.cattle-toolbar { gap: 10px; }
.search-box { min-height: 44px; height: auto; background: #fff; border: 1px solid #b9a77f; border-radius: 6px; }
.search-box input { font-size: 16px; }
.search-box kbd { font-size: 12px; }
.filter-select select { height: 44px; font-size: 14px; border: 1px solid #b9a77f; border-radius: 6px; color: var(--ink); }
.result-line { font-size: 13px; color: var(--text-3); padding-block: 4px 10px; }
.empty-state { border-style: dashed; border-color: #b9a77f; }
.empty-state h2 { font-size: 22px; }.empty-state p { font-size: 14px; }
.empty-icon { display: none; }
.settings-copy h2 { font-size: 17px; }.settings-copy p { font-size: 14px; color: var(--text-3); }
.settings-state { font-size: 12px; color: var(--ok); }
.settings-icon, .reminder-calendar-icon, .coming-icon { border-radius: 6px; }
.reminder-copy strong, .reminder-date strong { font-size: 14px; }
.reminder-copy small, .reminder-date small { font-size: 12px; color: var(--text-3); }
.reminder-date small { color: #70541f; }
.reminder-overdue { border-left: 4px solid var(--danger); background: #fffaf8; }
.reminder-overdue .reminder-date small { color: var(--danger); }
.reminders-empty { font-size: 14px; border-radius: 6px; }
.calendar-summary { gap: 0; background: var(--card); border: 1px solid var(--rule); border-radius: 6px; }
.calendar-summary .calendar-stat { border: 0; border-right: 1px solid var(--rule); border-radius: 0; background: transparent; }
.calendar-summary .calendar-stat:last-child { border-right: 0; }
.calendar-stat span { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--text-2); }
.calendar-stat strong { font-size: 28px; }
.account-farm-card { padding: 24px; }
.account-farm-card h2 { font-size: 22px; }
.account-farm-card > .muted { font-size: 14px; }
.migration-details { font-size: 14px; }
.settings-footer { font-size: 13px; color: var(--text-3); }
.toast { font-size: 14px; background: var(--ink); border-radius: 6px; border-left: 4px solid var(--amber); }

/* Dialogs */
.animal-dialog, .profile-dialog, .paywall-dialog { border: 1px solid var(--rule); border-radius: 8px; background: var(--card); box-shadow: 0 20px 50px #2a251c40; }
.animal-dialog::backdrop, .profile-dialog::backdrop, .paywall-dialog::backdrop { background: #2a251c99; backdrop-filter: none; }
.dialog-heading h2 { font-size: 24px; }.dialog-heading .muted { font-size: 14px; }
.profile-cover { background: #25352c; border-bottom: 2px solid var(--amber); }
.profile-cover::before, .profile-cover::after { display: none; }
.profile-close { background: #ffffff22; color: #fff; border-color: #ffffff55; }
.profile-avatar { border-color: var(--card); border-radius: 8px; }
.profile-title-line h2 { font-size: 24px; }
.profile-field span { font-size: 12px; color: var(--text-3); letter-spacing: .08em; }
.profile-field strong { font-size: 14px; }
.profile-notes { background: var(--paper); font-size: 14px; color: var(--text-2); }
.profile-section-heading h3 { font-size: 17px; }
.timeline-copy strong { font-size: 14px; }.timeline-copy small { font-size: 13px; color: var(--text-3); }
.paywall-price { background: #f8f0dc; border-color: #b9a77f; }
.paywall-price small, .paywall-terms { font-size: 12px; color: var(--text-3); }
.paywall-benefits { font-size: 14px; }

@media (max-width: 1100px) {
  .domain-notice { margin-left: 232px; }
  .sidebar { width: 232px; }.main-content { margin-left: 232px; }
  .stats-grid { gap: 0; }.stat-card { padding: 16px; }.stat-value { font-size: 32px; }
}

/* Mobile */
@media (max-width: 960px) {
  .domain-notice { margin-left: 0; }
  .main-content { margin-left: 0; padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
  .topbar { min-height: 60px; height: auto; padding-block: 8px; }
  .topbar-logo { display: block; width: 36px; height: 36px; }
  .topbar-actions .icon-button { display: none; }
  h1, .welcome-row h1 { font-size: 27px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
  .stat-card { border-bottom: 1px solid var(--rule); min-height: 104px; padding: 14px; }
  .stat-card:nth-child(2n) { border-right: 0; }
  .stat-card:nth-last-child(-n+2) { border-bottom: 0; }
  .stat-value { font-size: 30px; }
  .stat-top, .stat-foot { font-size: 12px; }
  .farm-banner { padding: 16px 18px; min-height: 0; }
  .farm-banner h2 { font-size: 23px; }
  .farm-banner p { font-size: 14px; max-width: none; }
  .mobile-nav { background: #25352c; border-top: 1px solid #405849; box-shadow: none; padding: 4px max(4px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left)); gap: 2px; }
  .mobile-nav .nav-item { width: 20%; min-width: 0; min-height: 52px; padding: 6px 2px; border-left: 0; border-top: 3px solid transparent; border-radius: 0; font-size: 12px; font-weight: 600; color: #dfe8e2; text-align: center; overflow-wrap: anywhere; }
  .mobile-nav .nav-item.active { background: #344b3d; color: #fff; border-top-color: var(--amber); }
  .mobile-nav .nav-icon { font-size: 18px; color: inherit; }
  .mobile-nav .nav-count { display: none; }
  .welcome-row, .page-heading { flex-wrap: wrap; gap: 14px; }
  .welcome-row > .button, .page-heading .button { white-space: normal; }
  .welcome-row > .button { width: 100%; }
  .section-heading { margin-top: 28px; }
  .muted, .settings-copy p { font-size: 14px; }
  .animal-card, .cattle-row { padding: 10px 12px; }
  .cattle-name strong { font-size: 15px; }
  .cattle-meta, .cattle-meta span, .status-pill { font-size: 12px; }
  .reminder-copy strong, .reminder-date strong, .settings-copy h2 { font-size: 15px; }
  .reminder-copy small, .reminder-date small { white-space: normal; }
  .calendar-stat strong { font-size: 24px; }
  .account-farm-card { padding: 18px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .local-badge { font-size: 12px; padding: 4px 10px; }
}
@media (max-width: 480px) {
  .auth-screen { padding-inline: 12px; }
  .auth-card { padding: 24px 18px 20px; }
  .auth-card h1 { font-size: 25px; }
  .auth-actions .button { flex-basis: 100%; }
  .auth-actions { flex-direction: column; align-items: stretch; }
  .auth-actions .text-button { justify-content: center; }
  .calendar-summary { grid-template-columns: 1fr; }
  .calendar-summary .calendar-stat { border-right: 0; border-bottom: 1px solid var(--rule); }
  .calendar-summary .calendar-stat:last-child { border-bottom: 0; }
  .dialog-actions .button { flex: 1 1 140px; }
}
@media (max-width: 390px) {
  .main-content { padding-inline: max(14px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-right)); }
  .welcome-row h1 { font-size: 25px; }
  .stat-value { font-size: 27px; }
  .mobile-nav .nav-item { font-size: 11px; }
  .status-pill { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
/* Adapted from the focus-label idea in Uiverse.io "Email" input by Alanav29 (MIT);
   see vendor/ui-attribution.txt. Rewritten for this palette; no animation. */
.auth-card .field > span { width: fit-content; padding: 0 2px 2px; border-bottom: 2px solid transparent; }
.auth-card .field:focus-within > span { color: var(--accent-dark); border-bottom-color: var(--accent); }