:root {
  color-scheme: light;
  --forest: #183a2e;
  --forest-2: #244b3d;
  --leaf: #c5d6a6;
  --leaf-soft: #edf3e4;
  --paper: #f5f6f0;
  --white: #fff;
  --ink: #20332b;
  --muted: #7d8a82;
  --line: #e7ebe3;
  --soft: #f8faf6;
  --blue: #3e7d91;
  --rose: #a8554d;
  --amber: #ad7e39;
  --shadow: 0 8px 28px rgba(30, 52, 41, .055);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(89, 132, 96, .3); outline-offset: 2px; }
button[hidden], [hidden] { display: none !important; }

.app-shell { min-height: 100vh; }
.topbar { position: sticky; z-index: 20; top: 0; height: 76px; display: grid; grid-template-columns: 260px 1fr auto; align-items: center; gap: 32px; padding: 0 34px; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.brand { display: inline-flex; align-items: center; gap: 11px; width: fit-content; text-decoration: none; color: var(--ink); }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; color: #e5edda; background: var(--forest); }
.brand strong { display: block; font: 800 14px/1.2 'Manrope', sans-serif; letter-spacing: -.2px; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.topbar-center { align-self: center; }
.topbar-center h1 { margin: 2px 0 0; font: 700 18px/1.2 'Manrope', sans-serif; letter-spacing: -.35px; }
.eyebrow { display: block; color: #8a978c; font-size: 9px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.sync-state { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.sync-state.local { color: #806335; background: #fbf2df; }
.sync-state.synced { color: #3e7658; background: #eaf3e9; }
.sync-button { border: 0; cursor: pointer; }
.sync-button:hover { background: #dcebd9; }
.icon-button, .avatar { display: inline-grid; place-items: center; border: 0; cursor: pointer; }
.icon-button { width: 38px; height: 38px; border-radius: 12px; color: #66766c; background: transparent; }
.icon-button:hover { color: var(--forest); background: var(--soft); }
.avatar { width: 34px; height: 34px; border-radius: 50%; color: var(--forest); background: var(--leaf-soft); font-weight: 700; }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border: 1px solid transparent; border-radius: 12px; cursor: pointer; font-size: 12px; font-weight: 700; text-decoration: none; transition: transform .15s ease, background .15s ease, box-shadow .15s ease; }
.button:active { transform: scale(.98); }
.button-primary { color: #fff; background: var(--forest); box-shadow: 0 5px 12px rgba(24,58,46,.13); }
.button-primary:hover { background: var(--forest-2); }
.button:disabled { opacity: .65; cursor: wait; }
.button-outline { color: var(--forest); background: #fff; border-color: #dfe7dc; }
.button-outline:hover { background: var(--leaf-soft); }
.header-add { min-height: 38px; padding: 0 13px; border-radius: 10px; font-size: 11px; }
.header-import { min-height: 38px; padding: 0 12px; border-radius: 10px; font-size: 10px; }
.compact { min-height: 35px; padding: 0 12px; font-size: 11px; }

.sidebar { position: fixed; z-index: 10; top: 76px; bottom: 0; left: 0; width: 260px; display: flex; flex-direction: column; padding: 28px 19px 20px; background: #fff; border-right: 1px solid var(--line); }
.side-caption { margin: 0 0 14px 11px; color: #9aa49d; font-size: 9px; font-weight: 700; letter-spacing: 1.3px; }
.sidebar nav { display: grid; gap: 5px; }
.nav-item { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border: 0; border-radius: 11px; color: #738078; background: transparent; text-align: left; cursor: pointer; font-size: 12px; font-weight: 600; }
.nav-item:hover { color: var(--forest); background: #f7f9f5; }
.nav-item.active { color: var(--forest); background: var(--leaf-soft); font-weight: 700; }
.side-bottom { margin-top: auto; padding: 16px 8px 0; border-top: 1px solid var(--line); }
.side-farm { display: flex; align-items: center; gap: 10px; }
.farm-dot { width: 9px; height: 9px; border-radius: 50%; background: #89a879; box-shadow: 0 0 0 4px #edf3e7; }
.side-farm strong, .side-farm small { display: block; }
.side-farm strong { font-size: 11px; }
.side-farm small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.side-bottom p { margin: 15px 0 0; color: #98a199; font-size: 9px; }
.main-content { max-width: 1560px; min-height: calc(100vh - 76px); margin-left: 260px; padding: 33px 38px 54px; }
.page-stack { display: grid; gap: 22px; }
.welcome-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 1px; }
.welcome-row .eyebrow { margin-bottom: 5px; }
.welcome-row h2 { margin: 0; font: 800 24px/1.25 'Manrope', sans-serif; letter-spacing: -.7px; }
.welcome-row p.muted { margin: 7px 0 0; font-size: 12px; }
.muted { color: var(--muted); }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.stats-grid.three-stats { grid-template-columns: repeat(3, minmax(0,1fr)); }
.stat-card { min-height: 142px; padding: 18px 19px; border: 1px solid #e9ede6; border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label { color: #748178; font-size: 11px; font-weight: 600; }
.stat-icon, .panel-icon, .quick-icon { display: grid; flex: 0 0 auto; place-items: center; border-radius: 11px; }
.stat-icon { width: 34px; height: 34px; }
.stat-icon.green, .quick-icon.green { color: #4f7955; background: #edf4e7; }
.stat-icon.blue, .quick-icon.blue { color: #41798e; background: #e8f2f5; }
.stat-icon.aqua, .quick-icon.aqua { color: #478077; background: #e9f3ef; }
.stat-icon.rose, .quick-icon.rose { color: #a75e55; background: #f8eeeb; }
.stat-icon.warm, .quick-icon.warm { color: #a77a38; background: #fbf3e4; }
.stat-value { display: block; margin: 19px 0 5px; color: var(--forest); font: 800 27px/1 'Manrope', sans-serif; letter-spacing: -.9px; }
.stat-value small { font: 600 14px 'DM Sans', sans-serif; letter-spacing: 0; }
.stat-detail { color: #98a199; font-size: 10px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 18px; }
.lower-grid { grid-template-columns: minmax(0, 1.15fr) minmax(320px, .9fr); }
.panel { min-width: 0; padding: 21px 22px; border: 1px solid #e9ede6; border-radius: 17px; background: #fff; box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 19px; }
.panel-heading h3 { margin: 4px 0 0; font: 700 16px/1.25 'Manrope', sans-serif; letter-spacing: -.25px; }
.panel-heading .muted { margin: 5px 0 0; font-size: 11px; }
.panel-icon { width: 36px; height: 36px; color: #4e7654; background: var(--leaf-soft); }
.panel-icon.warm { color: var(--amber); background: #fbf2df; }
.trend-panel { min-height: 286px; }
.chart-bars { min-height: 166px; display: grid; grid-template-columns: repeat(10, minmax(20px, 1fr)); align-items: end; gap: 11px; padding: 7px 3px 0; }
.chart-column { height: 153px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; }
.bar-value { color: #9aa49d; font-size: 9px; }
.bar-track { width: min(28px, 100%); height: 116px; display: flex; align-items: flex-end; overflow: hidden; border-radius: 7px 7px 3px 3px; background: #f1f4ef; }
.bar-fill { width: 100%; min-height: 6px; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, #91ad7c 0%, #537c5e 100%); }
.bar-date { color: #8e9a91; font-size: 9px; white-space: nowrap; }
.alert-count { display: grid; min-width: 31px; height: 31px; place-items: center; padding: 0 8px; border-radius: 10px; color: #9a574d; background: #f8eeeb; font-size: 11px; font-weight: 700; }
.rows-list { display: grid; }
.urgent-row { width: 100%; min-height: 57px; display: grid; grid-template-columns: 8px 1fr 20px; align-items: center; gap: 11px; padding: 9px 0; border: 0; border-top: 1px solid #f0f2ed; background: transparent; text-align: left; cursor: pointer; }
.urgent-row:hover .urgent-main strong, .text-link:hover { color: #658959; }
.priority-dot { width: 7px; height: 7px; border-radius: 50%; background: #d1a350; }
.priority-dot.high { background: #c26c5f; }
.urgent-main strong, .urgent-main small { display: block; }
.urgent-main strong { font-size: 11px; }
.urgent-main small { overflow: hidden; max-width: 310px; margin-top: 4px; color: #8d9990; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.urgent-arrow { color: #a9b2ab; }
.text-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 0; border: 0; color: var(--forest); background: transparent; cursor: pointer; font-size: 10px; font-weight: 700; }
.task-list { display: grid; }
.task-row { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px; min-height: 60px; padding: 8px 0; border: 0; border-top: 1px solid #f0f2ed; background: transparent; text-align: left; cursor: pointer; }
.task-date { width: 39px; height: 42px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 10px; color: var(--forest); background: #eff4e9; }
.task-date.late { color: #a4574d; background: #f8eeeb; }
.task-date strong { font: 700 15px 'Manrope', sans-serif; }
.task-date small { margin-top: 1px; font-size: 9px; text-transform: uppercase; }
.task-main strong, .task-main small { display: block; }
.task-main strong { font-size: 10px; }
.task-main small { margin-top: 4px; color: #8d9990; font-size: 9px; }
.task-status { padding: 5px 7px; border-radius: 8px; color: #5c805e; background: #edf4e7; font-size: 8px; white-space: nowrap; }
.task-status.late { color: #a4574d; background: #f8eeeb; }
.quick-panel { background: #fff; }
.import-banner { display: flex; align-items: center; gap: 14px; border-color: #dfe9d8; background: linear-gradient(105deg, #f0f6e9, #fff); }
.import-banner h3 { margin: 0; font: 700 13px 'Manrope', sans-serif; }
.import-banner p { margin: 5px 0 0; color: #7e8d82; font-size: 10px; }
.import-banner .button { margin-left: auto; flex: 0 0 auto; }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.quick-action { min-height: 58px; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid #edf0ea; border-radius: 12px; background: #fcfdfb; cursor: pointer; text-align: left; font-size: 10px; font-weight: 700; }
.quick-action:hover { border-color: #cbd8c4; background: #f7faf3; }
.quick-action > svg { margin-left: auto; color: #a0aaa2; }
.quick-icon { width: 33px; height: 33px; }
.empty-inline { padding: 20px 5px; color: #929e95; font-size: 11px; text-align: center; }

.list-panel { padding: 18px 21px 21px; }
.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 19px; }
.search-box { width: min(100%, 345px); min-height: 42px; display: flex; align-items: center; gap: 9px; padding: 0 12px; border: 1px solid #e8ede5; border-radius: 11px; color: #8b978e; background: #fbfcfa; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 11px; }
.search-box input::placeholder { color: #a2aca4; }
.filter-pills { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.filter-pill { min-height: 31px; padding: 0 12px; border: 1px solid #e8ede5; border-radius: 18px; color: #7c8980; background: #fff; cursor: pointer; font-size: 9px; font-weight: 600; }
.filter-pill.selected { color: #3f704c; border-color: #dce8d4; background: #edf4e7; }
.animal-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.animal-card { min-width: 0; min-height: 183px; display: flex; flex-direction: column; padding: 14px; border: 1px solid #edf0ea; border-radius: 14px; background: #fff; cursor: pointer; text-align: left; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.animal-card:hover { transform: translateY(-2px); border-color: #ccd9c7; box-shadow: 0 10px 20px rgba(30, 52, 41, .07); }
.animal-card-top { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.animal-avatar { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 11px; color: #517757; background: #edf4e7; font: 700 14px 'Manrope', sans-serif; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 5px 7px; border-radius: 8px; font-size: 8px; font-weight: 700; white-space: nowrap; }
.badge-good { color: #4e7953; background: #edf4e8; }
.badge-warn { color: #9b6d2f; background: #fbf2df; }
.animal-card-name { margin-top: 13px; }
.animal-card-name strong, .animal-card-name span { display: block; }
.animal-card-name strong { overflow: hidden; font: 700 13px 'Manrope', sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.animal-card-name span { margin-top: 4px; color: #8e9a91; font-size: 9px; }
.animal-card-info { display: grid; gap: 5px; margin-top: 12px; color: #758178; font-size: 9px; }
.animal-card-info span:last-child { display: flex; align-items: center; gap: 3px; }
.animal-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: auto; padding-top: 12px; }
.status-tag, .liters-tag { overflow: hidden; max-width: 62%; padding: 5px 7px; border-radius: 7px; color: #76847a; background: #f6f8f4; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.liters-tag { color: #497653; background: #eff5e8; }
.record-total { color: #8a968d; font-size: 10px; white-space: nowrap; }
.table-scroll { overflow-x: auto; width: 100%; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th { padding: 11px 12px; color: #8a968d; border-bottom: 1px solid #e9ede6; font-size: 9px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
td { padding: 13px 12px; border-bottom: 1px solid #f0f2ed; color: #647168; font-size: 10px; }
tr:last-child td { border-bottom: 0; }
td strong, td small { display: block; }
td strong { color: #34453b; font-size: 10px; }
td small { margin-top: 4px; color: #9aa49d; font-size: 8px; }
.amount-cell { font-weight: 700; }
.amount-cell.positive { color: #4e7953; }
.amount-cell.negative { color: #a75e55; }
.money-tag { display: inline-block; padding: 5px 8px; border-radius: 8px; font-size: 9px; font-weight: 700; }
.money-tag.income { color: #4e7953; background: #edf4e8; }
.money-tag.expense { color: #a75e55; background: #f8eeeb; }

.section-pills { margin-bottom: 19px; }
.section-pills .filter-pill { display: inline-flex; align-items: center; gap: 8px; }
.section-pills .filter-pill span { color: #98a49a; }
.event-heading { margin: 0 0 8px; padding-top: 20px; border-top: 1px solid #f0f2ed; }
.activity-list { display: grid; }
.activity-row { min-width: 0; display: grid; grid-template-columns: 45px 35px minmax(0,1fr) auto; align-items: center; gap: 12px; min-height: 76px; border-top: 1px solid #f0f2ed; }
.activity-date { width: 40px; height: 46px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 11px; color: var(--forest); background: #f0f4eb; }
.activity-date strong { font: 700 15px 'Manrope', sans-serif; }
.activity-date small { margin-top: 2px; font-size: 8px; }
.activity-icon { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 10px; color: #63805d; background: #f4f7ef; }
.activity-content { min-width: 0; }
.activity-content strong, .activity-content span, .activity-content small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-content strong { color: #384a3e; font-size: 11px; }
.activity-content span { margin-top: 4px; color: #67756c; font-size: 9px; }
.activity-content small { margin-top: 4px; color: #9aa49d; font-size: 9px; }
.activity-extra { color: #7d8a82; font-size: 9px; }
.empty-state { min-height: 160px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; color: #8c9a8f; text-align: center; }
.empty-state strong { color: #617269; font-size: 12px; }
.empty-state span { font-size: 10px; }

.bottom-nav, .mobile-add { display: none; }
.modal-backdrop { position: fixed; z-index: 50; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(17, 38, 29, .45); backdrop-filter: blur(4px); }
.modal-card { position: relative; width: min(100%, 620px); max-height: min(90vh, 850px); overflow-y: auto; padding: 24px; border: 1px solid rgba(255,255,255,.45); border-radius: 20px; background: #fff; box-shadow: 0 28px 70px rgba(15,34,25,.24); }
.form-modal { width: min(100%, 700px); }
.record-picker { width: min(100%, 600px); }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 21px; }
.modal-heading h2 { margin: 5px 0 0; font: 800 20px/1.2 'Manrope', sans-serif; letter-spacing: -.45px; }
.modal-heading .muted { margin: 6px 0 0; font-size: 11px; }
.record-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.record-type { min-height: 68px; display: flex; align-items: center; gap: 11px; padding: 11px; border: 1px solid #edf0ea; border-radius: 12px; background: #fff; text-align: left; cursor: pointer; }
.record-type:hover { border-color: #cddcc7; background: #f9fbf7; }
.record-type > span:nth-child(2) { min-width: 0; }
.record-type strong, .record-type small { display: block; }
.record-type strong { font-size: 11px; }
.record-type small { margin-top: 4px; color: #8b978e; font-size: 9px; }
.record-type > svg { margin-left: auto; color: #a4aea5; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 14px; }
.field { min-width: 0; display: flex; flex-direction: column; gap: 7px; color: #58685d; font-size: 10px; font-weight: 600; }
.field i { color: #ba685b; font-style: normal; }
.field input, .field select, .field textarea { width: 100%; min-height: 41px; padding: 9px 11px; border: 1px solid #e4eae1; border-radius: 10px; outline: none; color: #26392e; background: #fbfcfa; font-size: 11px; font-weight: 500; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #9db491; background: #fff; box-shadow: 0 0 0 3px rgba(132,163,117,.13); }
.field textarea { resize: vertical; min-height: 76px; line-height: 1.45; }
.field-full { grid-column: 1 / -1; }
.calc-note { display: flex; align-items: center; padding: 0 13px; border: 1px solid #e3eddd; border-radius: 10px; color: #4f7953; background: #f1f6eb; font-size: 11px; font-weight: 700; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; padding-top: 17px; border-top: 1px solid #eef1ec; }
.detail-modal { width: min(100%, 780px); padding: 24px 28px 29px; }
.detail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 21px; }
.back-button { width: auto; display: flex; gap: 5px; padding: 0 5px; font-size: 10px; }
.detail-hero { display: flex; align-items: center; gap: 15px; padding: 20px; border-radius: 16px; background: linear-gradient(120deg, #f0f5e9, #f9fbf6); }
.detail-avatar { width: 57px; height: 57px; display: grid; place-items: center; border-radius: 18px; color: #527855; background: #dfead4; font: 800 23px 'Manrope', sans-serif; }
.detail-hero > div { min-width: 0; flex: 1; }
.detail-hero h2 { margin: 3px 0; color: var(--forest); font: 800 23px 'Manrope', sans-serif; }
.detail-hero p { margin: 0; color: #76847a; font-size: 10px; }
.detail-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; margin: 15px 0 23px; }
.detail-stats > div { padding: 13px; border: 1px solid #edf0ea; border-radius: 12px; }
.detail-stats span, .detail-stats strong { display: block; }
.detail-stats span { color: #8b978e; font-size: 9px; }
.detail-stats strong { margin-top: 5px; font-size: 11px; }
.detail-columns { display: grid; grid-template-columns: 1fr .9fr; gap: 26px; }
.detail-columns h3 { margin: 0 0 12px; font: 700 13px 'Manrope', sans-serif; }
.detail-list { display: grid; gap: 0; margin: 0; }
.detail-list > div { display: grid; grid-template-columns: 130px 1fr; gap: 8px; padding: 9px 0; border-bottom: 1px solid #f0f2ed; }
.detail-list dt { color: #8a968d; font-size: 9px; }
.detail-list dd { margin: 0; color: #43534a; font-size: 10px; font-weight: 600; }
.mini-activity > div { display: flex; gap: 9px; padding: 9px 0; border-top: 1px solid #f0f2ed; }
.mini-dot { width: 7px; height: 7px; flex: 0 0 auto; margin-top: 4px; border-radius: 50%; background: #92aa7e; }
.mini-activity p { margin: 0; }
.mini-activity strong, .mini-activity small { display: block; }
.mini-activity strong { font-size: 10px; }
.mini-activity small { margin-top: 4px; color: #8b978e; font-size: 9px; line-height: 1.4; }

.login-screen, .error-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 10% 5%, #e8efde 0, transparent 32%), var(--paper); }
.login-card, .error-card { width: min(100%, 410px); padding: 32px; border: 1px solid #e9ede6; border-radius: 22px; background: #fff; box-shadow: 0 20px 60px rgba(30,52,41,.1); }
.login-brand { margin-bottom: 34px; }
.login-card h1, .error-card h1 { margin: 7px 0; color: var(--forest); font: 800 25px 'Manrope', sans-serif; letter-spacing: -.7px; }
.login-card > .muted, .error-card p { margin: 7px 0 22px; color: #809087; font-size: 11px; line-height: 1.6; }
#auth-form { display: grid; gap: 13px; }
.auth-message { min-height: 12px; margin: 0; color: #a2574d; font-size: 10px; }
.login-submit { width: 100%; }
.login-note { margin: 19px 0 0; color: #98a39a; font-size: 9px; line-height: 1.5; text-align: center; }
.error-card { text-align: center; }
.error-card .brand-mark { margin: 0 auto 16px; }
.toast { position: fixed; z-index: 90; right: 22px; bottom: 22px; max-width: min(400px, calc(100vw - 32px)); padding: 12px 16px; border: 1px solid #dbe7d5; border-radius: 12px; color: #315e3a; background: #f1f7eb; box-shadow: 0 10px 28px rgba(20,46,30,.15); font-size: 11px; font-weight: 700; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.toast-error { color: #964e45; border-color: #f0d7d2; background: #fff4f1; }

@media (max-width: 1180px) {
  .topbar { grid-template-columns: 230px 1fr auto; gap: 20px; padding: 0 24px; }
  .sidebar { width: 230px; }
  .main-content { margin-left: 230px; padding: 28px 24px 44px; }
  .animal-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .stats-grid { gap: 11px; }
  .stat-card { padding: 16px; }
}

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr auto; height: 68px; padding: 0 20px; }
  .topbar-center, .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 25px 22px 45px; }
  .dashboard-grid, .lower-grid { grid-template-columns: 1fr 1fr; }
  .animal-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

@media (max-width: 640px) {
  body { background: #f5f6f0; }
  .topbar { height: 62px; padding: 0 15px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 12px; }
  .brand strong { font-size: 12px; }
  .brand small { font-size: 9px; }
  .topbar-actions { gap: 7px; }
  .sync-state { gap: 4px; padding: 6px 8px; font-size: 9px; }
  .sync-state svg { width: 14px; height: 14px; }
  .sync-state span, .header-import span { display: none; }
  .header-import { width: 34px; min-height: 34px; padding: 0; }
  .topbar-actions .avatar, .topbar-actions .icon-button { display: none; }
  .header-add { width: 35px; min-height: 35px; padding: 0; border-radius: 11px; }
  .header-add span { display: none; }
  .header-add svg { width: 19px; height: 19px; }
  .main-content { min-height: calc(100vh - 62px); padding: 22px 15px 116px; }
  .page-stack { gap: 14px; }
  .welcome-row { align-items: flex-start; gap: 11px; }
  .welcome-row h2 { font-size: 21px; }
  .welcome-row p.muted { max-width: 250px; font-size: 10px; line-height: 1.45; }
  .welcome-row > .button { flex: 0 0 auto; min-height: 37px; padding: 0 10px; font-size: 9px; }
  .welcome-row > .button svg { width: 15px; height: 15px; }
  .stats-grid, .stats-grid.three-stats { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { min-height: 118px; padding: 13px; border-radius: 14px; }
  .stat-label { max-width: 100px; font-size: 9px; }
  .stat-icon { width: 30px; height: 30px; border-radius: 9px; }
  .stat-icon svg { width: 16px; height: 16px; }
  .stat-value { margin-top: 14px; font-size: 22px; }
  .stat-value small { font-size: 12px; }
  .stat-detail { font-size: 8px; }
  .dashboard-grid, .lower-grid { grid-template-columns: 1fr; gap: 12px; }
  .panel { padding: 17px 15px; border-radius: 15px; }
  .import-banner { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .import-banner > div { flex: 1 1 calc(100% - 43px); }
  .import-banner p { line-height: 1.5; }
  .import-banner .button { margin-left: 43px; }
  .panel-heading { margin-bottom: 15px; }
  .panel-heading h3 { font-size: 14px; }
  .panel-heading .muted { font-size: 9px; }
  .trend-panel { min-height: 255px; }
  .chart-bars { min-height: 146px; gap: 5px; }
  .chart-column { height: 138px; }
  .bar-track { width: min(22px,100%); height: 103px; }
  .bar-date { font-size: 8px; }
  .bar-value { font-size: 8px; }
  .urgent-row { min-height: 53px; }
  .urgent-main small { max-width: 270px; }
  .quick-actions { gap: 7px; }
  .quick-action { min-height: 53px; padding: 7px; font-size: 9px; }
  .quick-icon { width: 29px; height: 29px; }
  .bottom-nav { position: fixed; z-index: 25; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(5, 1fr); padding: 7px 5px max(8px, env(safe-area-inset-bottom)); border-top: 1px solid #e4e9e0; background: rgba(255,255,255,.96); backdrop-filter: blur(16px); }
  .bottom-nav .nav-item { min-height: 47px; flex-direction: column; justify-content: center; gap: 4px; padding: 3px 0; border-radius: 10px; font-size: 8px; }
  .bottom-nav .nav-item svg { width: 19px; height: 19px; }
  .bottom-nav .nav-item.active { color: #315d3d; background: transparent; }
  .bottom-nav .nav-item.active::before { width: 24px; height: 2px; margin-bottom: 1px; border-radius: 3px; background: #72906a; content: ""; }
  .mobile-add { position: fixed; z-index: 30; right: 17px; bottom: calc(75px + env(safe-area-inset-bottom)); width: 49px; height: 49px; display: grid; place-items: center; border: 3px solid var(--paper); border-radius: 17px; color: #fff; background: var(--forest); box-shadow: 0 8px 20px rgba(24,58,46,.24); cursor: pointer; }
  .list-toolbar { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
  .filter-pills { gap: 5px; }
  .filter-pill { min-height: 29px; padding: 0 9px; font-size: 8px; }
  .animal-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .animal-card { min-height: 172px; padding: 11px; border-radius: 12px; }
  .animal-card-top { align-items: flex-start; }
  .animal-avatar { width: 29px; height: 29px; border-radius: 9px; font-size: 12px; }
  .badge { max-width: 100px; overflow: hidden; padding: 4px 6px; font-size: 7px; text-overflow: ellipsis; }
  .animal-card-name { margin-top: 10px; }
  .animal-card-name strong { font-size: 11px; }
  .animal-card-name span { font-size: 8px; }
  .animal-card-info { margin-top: 9px; font-size: 8px; }
  .animal-card-bottom { align-items: flex-start; flex-direction: column; gap: 5px; padding-top: 8px; }
  .status-tag, .liters-tag { max-width: 100%; }
  .list-panel { padding: 15px 12px; }
  th { padding: 10px; font-size: 8px; }
  td { padding: 11px 10px; font-size: 9px; }
  .section-pills { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .section-pills .filter-pill { flex: 0 0 auto; }
  .event-heading { padding-top: 16px; }
  .activity-row { grid-template-columns: 39px 30px minmax(0,1fr); gap: 8px; min-height: 70px; }
  .activity-date { width: 36px; height: 42px; }
  .activity-date strong { font-size: 14px; }
  .activity-icon { width: 29px; height: 29px; }
  .activity-content strong { font-size: 10px; }
  .activity-content span, .activity-content small { font-size: 8px; }
  .activity-extra { display: none; }
  .record-total { font-size: 8px; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal-card { width: 100%; max-height: 92vh; padding: 21px 17px max(20px, env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; }
  .record-picker { max-height: 86vh; }
  .modal-heading h2 { font-size: 18px; }
  .record-type-grid { grid-template-columns: 1fr 1fr; gap: 7px; }
  .record-type { min-height: 71px; align-items: flex-start; gap: 7px; padding: 9px 7px; }
  .record-type .quick-icon { width: 28px; height: 28px; }
  .record-type .quick-icon svg { width: 16px; height: 16px; }
  .record-type strong { font-size: 9px; }
  .record-type small { font-size: 7px; line-height: 1.3; }
  .record-type > svg { width: 13px; height: 13px; margin-top: 7px; }
  .form-grid { grid-template-columns: 1fr 1fr; gap: 11px 9px; }
  .field { gap: 6px; font-size: 9px; }
  .field input, .field select, .field textarea { min-height: 40px; padding: 9px; font-size: 10px; }
  .field-full { grid-column: 1 / -1; }
  .form-actions { position: sticky; bottom: -20px; margin-top: 17px; padding: 12px 0 2px; background: #fff; }
  .form-actions .button { flex: 1; padding: 0 9px; font-size: 10px; }
  .detail-modal { max-height: 94vh; padding: 18px 15px max(22px, env(safe-area-inset-bottom)); }
  .detail-head { margin-bottom: 14px; }
  .detail-hero { flex-wrap: wrap; gap: 10px; padding: 14px; }
  .detail-avatar { width: 47px; height: 47px; border-radius: 15px; font-size: 19px; }
  .detail-hero h2 { font-size: 19px; }
  .detail-hero p { font-size: 9px; }
  .detail-hero > .badge { margin-left: 56px; }
  .detail-stats { gap: 6px; margin: 10px 0 17px; }
  .detail-stats > div { padding: 9px 7px; }
  .detail-stats span { font-size: 7px; }
  .detail-stats strong { font-size: 8px; }
  .detail-columns { grid-template-columns: 1fr; gap: 19px; }
  .detail-list > div { grid-template-columns: 105px 1fr; }
  .detail-columns h3 { font-size: 12px; }
  .toast { right: 13px; bottom: calc(82px + env(safe-area-inset-bottom)); left: 13px; max-width: none; text-align: center; }
  .login-card { padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
