/* ==========================================================================
   猪场智管 · PigFarm OS
   本地优先的猪场生产管理系统
   ========================================================================== */

:root {
  --font-sans: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --font-num: "Bahnschrift", "DIN Alternate", "Arial Narrow", "Microsoft YaHei UI", sans-serif;
  --ink: #173126;
  --ink-2: #2b473a;
  --muted: #77857c;
  --muted-2: #9aa79e;
  --bg: #f2f0e7;
  --bg-deep: #eae7da;
  --surface: #fffdf8;
  --surface-2: #f8f6ee;
  --surface-3: #f1eee2;
  --line: #e5e1d3;
  --line-strong: #d8d3c2;
  --green: #205c3e;
  --green-2: #2f7751;
  --green-deep: #102f22;
  --green-deeper: #0b241a;
  --green-soft: #e5efdf;
  --lime: #dceb7a;
  --lime-2: #cbdc5d;
  --lime-soft: #f2f7d5;
  --amber: #cc8a33;
  --amber-deep: #9e6620;
  --amber-soft: #fbf0dc;
  --rose: #c26557;
  --rose-soft: #fae9e4;
  --blue: #497c7e;
  --blue-soft: #e7f1f0;
  --gold: #a9822d;
  --gold-soft: #f7edd6;
  --shadow-sm: 0 4px 12px rgba(23, 49, 38, 0.04);
  --shadow: 0 16px 40px rgba(23, 49, 38, 0.07);
  --shadow-lg: 0 28px 70px rgba(12, 36, 26, 0.18);
  --radius: 18px;
  --radius-lg: 24px;
  --sidebar-w: 266px;
  --transition: 180ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(circle at 88% -8%, rgba(220, 235, 122, 0.22), transparent 27%),
    radial-gradient(circle at 32% 110%, rgba(32, 92, 62, 0.07), transparent 34%),
    var(--bg);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--lime); color: var(--green-deep); }
:focus-visible { outline: 2px solid var(--green-2); outline-offset: 2px; }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cfcaba; border-radius: 9px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b9b3a1; background-clip: content-box; border: 2px solid transparent; }

.svg-ico { width: 20px; height: 20px; flex: 0 0 auto; }

/* ---------- Boot ---------- */
.boot {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 50% 40%, rgba(220, 235, 122, 0.12), transparent 32%),
    var(--green-deep);
  color: #f8f8ec;
  transition: opacity 420ms ease, visibility 420ms ease;
}
.boot.done { opacity: 0; visibility: hidden; }
.boot-logo { width: 66px; height: 66px; border-radius: 20px; overflow: hidden; box-shadow: 0 16px 40px rgba(0,0,0,.25); }
.boot-title { margin-top: 20px; font-size: 25px; font-weight: 800; letter-spacing: 0.08em; }
.boot-sub { margin-top: 5px; font-size: 10px; letter-spacing: 0.2em; color: rgba(255,255,255,.5); }
.boot-bar { width: 136px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.12); margin-top: 24px; overflow: hidden; }
.boot-bar span { display: block; width: 45%; height: 100%; background: var(--lime); border-radius: inherit; animation: bootSlide 1.1s ease-in-out infinite; }
@keyframes bootSlide { 0% { transform: translateX(-110%); } 100% { transform: translateX(320%); } }

.app { min-height: 100vh; opacity: 0; transition: opacity 300ms ease; }
.app.ready { opacity: 1; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  padding: 23px 17px 18px;
  color: #e8eddf;
  background:
    radial-gradient(circle at 18% 0%, rgba(220, 235, 122, 0.12), transparent 28%),
    radial-gradient(circle at 100% 90%, rgba(76, 139, 102, 0.22), transparent 40%),
    linear-gradient(165deg, #153d2b 0%, #0e2c20 65%, #0b241a 100%);
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar::after {
  content: "";
  position: absolute; right: -90px; bottom: 60px; width: 220px; height: 220px;
  border: 1px solid rgba(220,235,122,.1); border-radius: 50%;
  box-shadow: 0 0 0 38px rgba(220,235,122,.025), 0 0 0 78px rgba(220,235,122,.018);
  pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 7px 22px; position: relative; z-index: 1; }
.brand-logo { width: 41px; height: 41px; border-radius: 13px; overflow: hidden; box-shadow: 0 8px 20px rgba(0,0,0,.18); flex: 0 0 auto; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.1; }
.brand-copy strong { font-size: 18px; letter-spacing: .03em; font-weight: 800; }
.brand-copy small { font-size: 8px; letter-spacing: .24em; color: rgba(219,235,159,.62); margin-top: 5px; font-weight: 600; }
.farm-switch {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 10px;
  margin: 0 2px 18px; padding: 11px 11px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: rgba(255,255,255,.045);
  transition: background var(--transition);
}
.farm-switch:hover { background: rgba(255,255,255,.075); }
.farm-monogram {
  width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--lime); color: var(--green-deep);
  font-size: 15px; font-weight: 800;
}
.farm-copy { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.farm-copy strong { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.farm-copy small { font-size: 10px; color: rgba(232,237,223,.45); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.farm-live { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(220,235,122,.12); flex: 0 0 auto; }
.farm-live i { display: block; }

.nav { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 3px; }
.nav-label {
  font-size: 9px; letter-spacing: .16em; font-weight: 700;
  color: rgba(232,237,223,.32);
  padding: 15px 12px 6px;
}
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  min-height: 42px; padding: 9px 12px;
  border-radius: 11px;
  color: rgba(235,240,228,.72);
  font-size: 12.5px; font-weight: 500;
  transition: color var(--transition), background var(--transition), transform var(--transition);
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #fff; background: rgba(220,235,122,.12); font-weight: 700; }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 11px; bottom: 11px; width: 2px; border-radius: 2px; background: var(--lime); }
.nav-item.active .nav-ico { color: var(--lime); }
.nav-ico { width: 19px; height: 19px; color: rgba(235,240,228,.55); display: grid; place-items: center; }
.nav-ico .svg-ico { width: 18px; height: 18px; }
.nav-count { margin-left: auto; font-style: normal; font-size: 10px; font-family: var(--font-num); color: rgba(235,240,228,.38); }
.nav-badge {
  margin-left: auto; font-style: normal; font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--lime); color: var(--green-deep);
  display: inline-grid; place-items: center; font-family: var(--font-num);
}
.sidebar-foot { margin-top: auto; padding: 24px 9px 0; position: relative; z-index: 1; }
.save-state { display: flex; align-items: center; gap: 7px; font-size: 10px; color: rgba(235,240,228,.46); }
.save-dot { width: 6px; height: 6px; border-radius: 50%; background: #8fb97d; box-shadow: 0 0 0 3px rgba(143,185,125,.12); }
.backup-link { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; color: rgba(220,235,122,.8); margin-top: 9px; }
.backup-link .svg-ico { width: 12px; height: 12px; }
.backup-link:hover { color: var(--lime); }
.version { margin-top: 15px; font-family: var(--font-num); font-size: 9px; letter-spacing: .12em; color: rgba(235,240,228,.22); }
.icp-link { display: block; margin-top: 6px; font-size: 9px; color: rgba(235,240,228,.42); text-decoration: none; letter-spacing: .02em; }
.icp-link:hover { color: var(--lime); text-decoration: underline; }
.sidebar-backdrop { display: none; }

/* ---------- Topbar ---------- */
.main { margin-left: var(--sidebar-w); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: 76px; padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  background: rgba(242, 240, 231, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(216, 211, 194, 0.6);
}
.topbar-left, .topbar-actions { display: flex; align-items: center; gap: 13px; }
.crumb { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.crumb i { font-style: normal; color: #b9b4a5; font-size: 11px; }
.crumb strong { color: var(--ink); font-weight: 700; }
.menu-btn { display: none !important; }
.icon-btn {
  position: relative;
  width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 11px;
  display: grid; place-items: center; background: rgba(255,253,248,.72); color: var(--ink-2);
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.icon-btn:hover { background: #fff; border-color: var(--line-strong); transform: translateY(-1px); }
.icon-btn .svg-ico { width: 18px; height: 18px; }
.notify-dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--rose); border: 1.5px solid var(--bg); }
.global-search {
  display: flex; align-items: center; gap: 8px;
  width: 258px; height: 38px; padding: 0 10px 0 12px;
  border: 1px solid var(--line); border-radius: 11px;
  background: rgba(255,253,248,.68);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.global-search:focus-within { background: #fff; border-color: #a9b8a7; box-shadow: 0 0 0 3px rgba(32,92,62,.06); }
.global-search .svg-ico { width: 16px; height: 16px; color: var(--muted); }
.global-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 11.5px; }
.global-search input::placeholder { color: var(--muted-2); }
.global-search kbd { font-family: var(--font-num); font-size: 8px; letter-spacing: .04em; color: var(--muted-2); border: 1px solid var(--line); border-radius: 5px; padding: 2px 5px; background: var(--surface-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 15px;
  border: 1px solid transparent; border-radius: 10px;
  font-size: 12px; font-weight: 600; line-height: 1;
  white-space: nowrap; transition: all var(--transition);
}
.btn .svg-ico { width: 16px; height: 16px; }
.btn-primary { background: var(--green); color: #fff; box-shadow: 0 7px 16px rgba(32,92,62,.17); }
.btn-primary:hover { background: var(--green-2); transform: translateY(-1px); box-shadow: 0 10px 20px rgba(32,92,62,.23); }
.btn-outline { background: var(--surface); border-color: var(--line-strong); color: var(--ink-2); }
.btn-outline:hover { border-color: #a7b3a3; background: #fff; }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: transparent; }
.btn-ghost:hover { background: rgba(32,92,62,.06); }
.btn-soft { background: var(--green-soft); color: var(--green); }
.btn-soft:hover { background: #dbe9d2; }
.btn-danger { background: var(--rose); color: #fff; }
.btn-danger:hover { background: #ae574b; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 11px; border-radius: 9px; }
.btn-lg { height: 44px; padding: 0 19px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn-link { border: 0; background: transparent; color: var(--green); font-size: 11.5px; font-weight: 600; padding: 3px; }
.btn-link:hover { color: var(--green-2); text-decoration: underline; text-underline-offset: 3px; }
.btn-icon-only { width: 30px; height: 30px; padding: 0; border-radius: 8px; }
.btn-icon-only .svg-ico { width: 15px; height: 15px; }

.quick-add { position: relative; }
.quick-add summary { list-style: none; cursor: pointer; }
.quick-add summary::-webkit-details-marker { display: none; }
.quick-add[open] summary { background: var(--green-2); }
.quick-menu {
  position: absolute; right: 0; top: calc(100% + 9px); z-index: 80;
  width: 260px; padding: 10px;
  max-height: calc(100vh - 96px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: popIn 160ms ease both;
}
.quick-menu::before { content: ""; position: absolute; top: -5px; right: 30px; width: 9px; height: 9px; background: var(--surface); border-left: 1px solid var(--line); border-top: 1px solid var(--line); transform: rotate(45deg); }
.quick-menu p { font-size: 9px; letter-spacing: .14em; color: var(--muted-2); padding: 4px 8px 8px; font-weight: 700; }
.quick-menu button {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  border: 0; background: transparent; padding: 8px; border-radius: 10px;
  transition: background var(--transition);
}
.quick-menu button:hover { background: var(--surface-2); }
.quick-menu button > span:last-child { display: flex; flex-direction: column; line-height: 1.3; }
.quick-menu strong { font-size: 11.5px; font-weight: 700; }
.quick-menu small { color: var(--muted); font-size: 9.5px; margin-top: 2px; }
.q-ico { width: 31px; height: 31px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; }
.q-ico .svg-ico { width: 16px; height: 16px; }
.q-ico.green { background: var(--green-soft); color: var(--green); }
.q-ico.rose { background: var(--rose-soft); color: var(--rose); }
.q-ico.amber { background: var(--amber-soft); color: var(--amber); }
.q-ico.blue { background: var(--blue-soft); color: var(--blue); }
.q-ico.brown { background: #f0e8dc; color: #8e6a45; }
.q-ico.gold { background: var(--gold-soft); color: var(--gold); }
@keyframes popIn { from { opacity: 0; transform: translateY(-5px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.profile { display: flex; align-items: center; gap: 9px; padding: 3px 4px 3px 3px; border-radius: 12px; transition: background var(--transition); }
.profile:hover { background: rgba(255,255,255,.55); }
.avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--green-deep); color: var(--lime); font-size: 12px; font-weight: 800; flex: 0 0 auto; }
.profile-copy { display: flex; flex-direction: column; line-height: 1.2; }
.profile-copy strong { font-size: 11px; font-weight: 700; }
.profile-copy small { font-size: 9px; color: var(--muted); margin-top: 2px; }

/* ---------- Layout / Page ---------- */
.view { width: 100%; max-width: 1580px; margin: 0 auto; padding: 27px 32px 50px; }
.page { animation: pageIn 300ms ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.eyebrow {
  display: flex; align-items: center; gap: 7px;
  font-size: 9.5px; letter-spacing: .17em; font-weight: 800; color: var(--green);
  text-transform: uppercase; margin-bottom: 6px;
}
.eyebrow::before { content: ""; width: 17px; height: 2px; background: var(--lime-2); border-radius: 2px; }
.page-head h1 { font-size: 28px; line-height: 1.2; font-weight: 800; letter-spacing: -.035em; }
.page-sub { font-size: 12px; color: var(--muted); margin-top: 7px; }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.head-meta { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.meta-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; color: var(--muted); padding: 4px 8px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,253,248,.55); }
.meta-pill .svg-ico { width: 12px; height: 12px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-flat { box-shadow: none; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 19px 21px 0; }
.card-head h3 { font-size: 13.5px; font-weight: 800; letter-spacing: -.01em; }
.card-head p { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.card-head .card-tools { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.card-body { padding: 17px 21px 21px; }
.card-body.tight { padding-top: 12px; }
.card-body.flush { padding: 0; }
.card-link { font-size: 10.5px; color: var(--green); font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.card-link:hover { color: var(--green-2); }
.card-link .svg-ico { width: 13px; height: 13px; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 17px; }
.kpi {
  position: relative; overflow: hidden;
  padding: 17px 18px 15px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi::after { content: ""; position: absolute; width: 92px; height: 92px; right: -34px; bottom: -41px; border-radius: 50%; background: var(--kpi-tint, var(--green-soft)); opacity: .65; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi-label { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); font-weight: 600; }
.kpi-label .svg-ico { width: 13px; height: 13px; }
.kpi-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--kpi-tint, var(--green-soft)); color: var(--kpi-color, var(--green)); }
.kpi-icon .svg-ico { width: 17px; height: 17px; }
.kpi-value { display: flex; align-items: baseline; gap: 5px; margin-top: 10px; font-family: var(--font-num); }
.kpi-value strong { font-size: 30px; line-height: 1; font-weight: 700; letter-spacing: -.02em; }
.kpi-value span { font-size: 10px; color: var(--muted); font-family: var(--font-sans); font-weight: 500; }
.kpi-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 5px; margin-top: 9px; font-size: 9.5px; color: var(--muted); line-height: 1.35; min-height: 12px; }
.trend { display: inline-flex; align-items: center; gap: 2px; font-family: var(--font-num); font-weight: 700; font-size: 10px; padding: 1px 4px; border-radius: 4px; }
.trend.up { color: #39714c; background: #ebf4e7; }
.trend.down { color: #b45a4d; background: #faeae7; }
.trend.flat { color: var(--muted); background: var(--surface-2); }
.trend .svg-ico { width: 9px; height: 9px; }

/* ---------- Buttons group / tabs / chips ---------- */
.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.toolbar-search { position: relative; display: flex; align-items: center; min-width: 210px; }
.toolbar-search .svg-ico { position: absolute; left: 11px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 11px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--surface); font-size: 11.5px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.toolbar-search .input { padding-left: 33px; }
.input:hover, .select:hover, .textarea:hover { border-color: #b8b4a4; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: #8ea78e; box-shadow: 0 0 0 3px rgba(32,92,62,.07); background: #fff; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2377857c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 29px; }
.textarea { height: auto; min-height: 72px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.filter-chips { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 29px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--line); background: rgba(255,253,248,.52);
  color: var(--muted); font-size: 10px; font-weight: 600;
  transition: all var(--transition);
}
.chip:hover { border-color: #b5c0b2; color: var(--ink); }
.chip.active { background: var(--green); border-color: var(--green); color: #fff; }
.chip .count { font-family: var(--font-num); opacity: .55; }
.tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab {
  position: relative; padding: 11px 14px 12px; border: 0; background: transparent;
  color: var(--muted); font-size: 11.5px; font-weight: 600; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--green); border-bottom-color: var(--green); }
.tab .tab-count { font-family: var(--font-num); font-size: 9px; padding: 1px 5px; border-radius: 5px; background: var(--surface-3); margin-left: 4px; }
.tab.active .tab-count { background: var(--green-soft); }
.segmented { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--surface-3); }
.segmented button { border: 0; background: transparent; height: 28px; padding: 0 10px; border-radius: 7px; font-size: 10px; color: var(--muted); font-weight: 600; }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- Badges / status ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: 6px; font-size: 9.5px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-green { color: #33704b; background: #eaf3e4; }
.badge-amber { color: #a06b22; background: #fbf0da; }
.badge-red { color: #b15447; background: #fae9e5; }
.badge-blue { color: #3f6f72; background: #e7f1f0; }
.badge-gray { color: #778178; background: #f0eee4; }
.badge-rose { color: #b25c63; background: #fae9ec; }
.badge-gold { color: #94701f; background: #f7edd6; }
.tag { display: inline-flex; align-items: center; font-family: var(--font-num); font-size: 10px; letter-spacing: .03em; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 11.5px; white-space: nowrap; }
.data-table th {
  padding: 10px 13px; text-align: left;
  color: var(--muted); font-size: 9.5px; font-weight: 700; letter-spacing: .04em;
  background: #f9f7ef; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1;
}
.data-table td { padding: 11px 13px; border-bottom: 1px solid #f0ede2; vertical-align: middle; }
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: #fbfaf4; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .num { font-family: var(--font-num); font-size: 11px; }
.data-table .strong { font-weight: 700; color: var(--ink); }
.data-table .muted { color: var(--muted); }
.table-actions { display: flex; align-items: center; gap: 3px; }
.row-main { display: flex; align-items: center; gap: 9px; }
.pig-avatar {
  width: 29px; height: 29px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 9px; font-weight: 800; letter-spacing: -.02em;
  background: var(--green-soft); color: var(--green);
}
.pig-avatar.boar { background: var(--blue-soft); color: var(--blue); }
.pig-avatar.piglet { background: var(--amber-soft); color: var(--amber); }
.pig-avatar.finish { background: #efe8dc; color: #8f6b43; }
.pig-avatar.reserve { background: var(--rose-soft); color: var(--rose); }
.row-title { display: flex; flex-direction: column; gap: 1px; }
.row-title strong { font-size: 11.5px; font-weight: 700; }
.row-title small { font-size: 9px; color: var(--muted); }
.avatar-stack { display: flex; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 10px; color: var(--muted); }
.table-foot strong { color: var(--ink); font-family: var(--font-num); }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-ico { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 12px; color: var(--muted-2); }
.empty-ico .svg-ico { width: 21px; height: 21px; }
.empty-state strong { font-size: 12px; color: var(--ink-2); margin-bottom: 3px; }
.empty-state p { font-size: 10.5px; max-width: 290px; line-height: 1.6; }
.empty-state .btn { margin-top: 13px; }

/* ---------- Dashboard ---------- */
.hero {
  position: relative; overflow: hidden;
  display: flex; justify-content: space-between; gap: 28px;
  padding: 27px 30px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 82% 30%, rgba(220, 235, 122, 0.18), transparent 26%),
    radial-gradient(circle at 96% 100%, rgba(132, 185, 133, 0.18), transparent 32%),
    linear-gradient(125deg, #123b29 0%, #1b5136 56%, #256344 100%);
  color: #f8f9ee;
  box-shadow: 0 18px 40px rgba(18, 59, 41, 0.16);
  margin-bottom: 16px;
}
.hero::before { content: ""; position: absolute; right: -52px; top: -78px; width: 260px; height: 260px; border: 1px solid rgba(220,235,122,.12); border-radius: 50%; box-shadow: 0 0 0 44px rgba(220,235,122,.035), 0 0 0 92px rgba(220,235,122,.022); }
.hero::after { content: ""; position: absolute; left: 38%; bottom: -64px; width: 140px; height: 140px; border-radius: 50%; background: rgba(220,235,122,.04); }
.hero-main { position: relative; z-index: 1; max-width: 660px; }
.hero-date { display: flex; align-items: center; gap: 7px; font-size: 9.5px; letter-spacing: .08em; color: rgba(235,244,222,.62); font-weight: 600; }
.hero-date i { width: 5px; height: 5px; border-radius: 50%; background: var(--lime); display: inline-block; }
.hero h1 { margin-top: 10px; font-size: 27px; line-height: 1.3; font-weight: 800; letter-spacing: -.035em; }
.hero h1 em { font-style: normal; color: var(--lime); }
.hero-sub { margin-top: 8px; font-size: 11.5px; color: rgba(235,244,222,.68); line-height: 1.65; max-width: 570px; }
.hero-sub strong { color: #fff; font-family: var(--font-num); font-size: 13px; }
.hero-actions { display: flex; gap: 8px; margin-top: 17px; flex-wrap: wrap; }
.btn-light { background: var(--lime); color: var(--green-deep); }
.btn-light:hover { background: #e8f394; transform: translateY(-1px); }
.btn-ghost-light { border-color: rgba(255,255,255,.18); color: rgba(255,255,255,.82); background: rgba(255,255,255,.04); }
.btn-ghost-light:hover { background: rgba(255,255,255,.1); }
.hero-side { position: relative; z-index: 1; flex: 0 0 auto; display: flex; flex-direction: column; justify-content: center; gap: 9px; min-width: 185px; }
.hero-pig {
  position: absolute; right: 150px; bottom: -16px; width: 150px; height: 150px;
  opacity: .08; pointer-events: none;
}
.hero-stat { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.09); }
.hero-stat:last-child { border-bottom: 0; }
.hero-stat span { font-size: 10px; color: rgba(235,244,222,.6); }
.hero-stat strong { font-family: var(--font-num); font-size: 15px; font-weight: 700; color: #fff; }
.hero-stat strong small { font-size: 9px; font-family: var(--font-sans); color: rgba(235,244,222,.55); font-weight: 500; margin-left: 2px; }

.attention {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 15px; margin-bottom: 17px;
  border: 1px solid #ecdfbe; border-radius: 13px;
  background: linear-gradient(90deg, #fdf7e8, #fbf3df);
  color: #775421;
}
.attention-ico { width: 28px; height: 28px; border-radius: 8px; background: #f5e5c4; display: grid; place-items: center; flex: 0 0 auto; }
.attention-ico .svg-ico { width: 15px; height: 15px; }
.attention-copy { font-size: 10.5px; line-height: 1.45; }
.attention-copy strong { font-weight: 800; }
.attention-link { margin-left: auto; font-size: 10px; font-weight: 700; color: #8c631f; white-space: nowrap; display: inline-flex; align-items: center; gap: 3px; }
.attention-link .svg-ico { width: 12px; height: 12px; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; align-items: start; }
.scroll-panel { max-height: 340px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding-right: 4px; }
.barn-list-scroll { max-height: 260px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.barn-list-scroll.expanded { max-height: none; overflow: visible; }
.barn-list-scroll thead th { position: sticky; top: 0; z-index: 1; background: #f5f3ea; }
.barn-list-scroll::-webkit-scrollbar { width: 6px; }
.barn-list-scroll::-webkit-scrollbar-thumb { background: #d8d2c2; border-radius: 9px; }
.barn-row[draggable="true"] { cursor: grab; }
.barn-row.dragging { opacity: .45; background: var(--surface-2); }
.barn-drag { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-right: 5px; color: var(--muted-2); vertical-align: -3px; cursor: grab; touch-action: none; }
.barn-drag .svg-ico { width: 11px; height: 11px; }
.scroll-panel::-webkit-scrollbar, .barn-bars::-webkit-scrollbar, .reminder-list::-webkit-scrollbar, .task-list::-webkit-scrollbar, .activity-list::-webkit-scrollbar, .timeline::-webkit-scrollbar { width: 6px; }
.scroll-panel::-webkit-scrollbar-thumb, .barn-bars::-webkit-scrollbar-thumb, .reminder-list::-webkit-scrollbar-thumb, .task-list::-webkit-scrollbar-thumb, .activity-list::-webkit-scrollbar-thumb, .timeline::-webkit-scrollbar-thumb { background: #d8d2c2; border-radius: 9px; }
.scroll-panel::-webkit-scrollbar-track, .barn-bars::-webkit-scrollbar-track, .reminder-list::-webkit-scrollbar-track, .task-list::-webkit-scrollbar-track, .activity-list::-webkit-scrollbar-track, .timeline::-webkit-scrollbar-track { background: transparent; }
.dash-grid.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dash-grid.three { grid-template-columns: 1.05fr 0.95fr 0.9fr; }
.chart-box { position: relative; width: 100%; height: 224px; }
.chart-box.tall { height: 272px; }
.chart-box.short { height: 168px; }
.chart-box canvas { width: 100%; height: 100%; }
.chart-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 9.5px; color: var(--muted); }
.legend-dot { width: 7px; height: 7px; border-radius: 3px; background: var(--green); }
.legend-dot.lime { background: var(--lime-2); }
.legend-dot.amber { background: var(--amber); }
.legend-dot.rose { background: var(--rose); }
.legend-dot.blue { background: var(--blue); }

.structure-wrap { display: flex; align-items: center; justify-content: center; gap: 20px; min-height: 224px; }
.donut-box { width: 152px; height: 152px; flex: 0 0 152px; position: relative; }
.donut-box canvas { width: 100%; height: 100%; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-center strong { font-family: var(--font-num); font-size: 26px; line-height: 1; }
.donut-center span { font-size: 9px; color: var(--muted); margin-top: 4px; }
.structure-list { flex: 1 1 0; min-width: 0; max-width: 360px; display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 8px 18px; }
.structure-row { display: grid; grid-template-columns: 7px 66px auto; align-items: center; justify-content: start; gap: 6px; font-size: 11px; min-width: 0; }
.structure-row i { width: 6px; height: 6px; border-radius: 2px; }
.structure-row span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.structure-row strong { font-family: var(--font-num); font-size: 11.5px; font-weight: 700; white-space: nowrap; text-align: left; }
.structure-row strong em { font-family: var(--font-sans); font-style: normal; font-size: 8.5px; color: var(--muted); font-weight: 400; margin-left: 1px; }
.structure-row strong small { font-family: var(--font-sans); font-size: 8.5px; color: var(--muted-2); font-weight: 400; margin-left: 2px; }

.mini-list { display: flex; flex-direction: column; }
.mini-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f0ede2; flex: 0 0 auto; }
.mini-row:last-child { border-bottom: 0; padding-bottom: 0; }
.mini-row:first-child { padding-top: 0; }
.mini-date { width: 36px; flex: 0 0 auto; text-align: center; border-radius: 8px; background: var(--surface-2); padding: 4px 3px; border: 1px solid var(--line); }
.mini-date strong { display: block; font-family: var(--font-num); font-size: 13px; line-height: 1.1; }
.mini-date span { display: block; font-size: 8px; color: var(--muted); margin-top: 2px; }
.mini-date.urgent { background: var(--rose-soft); border-color: #f1d3cc; color: var(--rose); }
.mini-date.urgent span { color: #b77c72; }
.mini-main { min-width: 0; flex: 1; }
.mini-main strong { display: block; font-size: 10.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-main span { display: block; font-size: 9px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-side { flex: 0 0 auto; text-align: right; }
.mini-side strong { font-family: var(--font-num); font-size: 10.5px; }
.mini-side span { display: block; font-size: 8.5px; color: var(--muted); margin-top: 2px; }

.todo-row { display: flex; align-items: flex-start; gap: 9px; padding: 9px 0; border-bottom: 1px solid #f0ede2; }
.todo-row:last-child { border-bottom: 0; padding-bottom: 0; }
.todo-check { width: 16px; height: 16px; border: 1.5px solid #c8d0c3; border-radius: 5px; margin-top: 1px; flex: 0 0 auto; background: #fff; display: grid; place-items: center; color: transparent; }
.todo-check:hover { border-color: var(--green); }
.todo-check .svg-ico { width: 10px; height: 10px; }
.todo-row.done .todo-check { background: var(--green); border-color: var(--green); color: #fff; }
.todo-row.done .todo-main strong { text-decoration: line-through; color: var(--muted); }
.todo-main { flex: 1; min-width: 0; }
.todo-main strong { display: block; font-size: 10.5px; font-weight: 600; line-height: 1.4; }
.todo-main span { display: block; font-size: 8.8px; color: var(--muted); margin-top: 2px; }
.todo-priority { width: 5px; height: 5px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; }
.todo-priority.high { background: var(--rose); }
.todo-priority.mid { background: var(--amber); }
.todo-priority.low { background: #a9b5a7; }

.activity-list { display: flex; flex-direction: column; gap: 13px; max-height: 340px; overflow-y: auto; padding-right: 4px; }
.activity-item { display: flex; gap: 9px; position: relative; flex: 0 0 auto; }
.activity-item:not(:last-child)::after { content: ""; position: absolute; left: 12px; top: 28px; bottom: -13px; width: 1px; background: #ece8dc; }
.activity-dot { width: 25px; height: 25px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto; background: var(--surface-2); color: var(--muted); }
.activity-dot .svg-ico { width: 13px; height: 13px; }
.activity-dot.green { background: var(--green-soft); color: var(--green); }
.activity-dot.amber { background: var(--amber-soft); color: var(--amber); }
.activity-dot.blue { background: var(--blue-soft); color: var(--blue); }
.activity-dot.rose { background: var(--rose-soft); color: var(--rose); }
.activity-main { min-width: 0; padding-top: 1px; }
.activity-main p { font-size: 10px; line-height: 1.45; color: var(--ink-2); }
.activity-main p strong { font-weight: 700; }
.activity-main time { display: block; font-size: 8.5px; color: var(--muted-2); margin-top: 2px; }

/* ---------- Breeding ---------- */
.preg-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.preg-card {
  position: relative; overflow: hidden;
  padding: 13px 14px 12px;
  border: 1px solid var(--line); border-radius: 13px;
  background: linear-gradient(160deg, #fffdf8, #f8f6ed);
}
.preg-card.urgent { border-color: #eccfc7; background: linear-gradient(160deg, #fffaf7, #fbf0ec); }
.preg-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.preg-top strong { font-size: 12px; font-weight: 800; }
.preg-top span { font-size: 8.5px; color: var(--muted); margin-top: 1px; }
.preg-days { text-align: right; }
.preg-days strong { font-family: var(--font-num); font-size: 20px; line-height: 1; color: var(--green); }
.preg-days.urgent strong { color: var(--rose); }
.preg-days span { display: block; font-size: 8px; color: var(--muted); margin-top: 2px; }
.preg-bar { height: 5px; border-radius: 5px; background: #eae7db; margin: 11px 0 8px; overflow: hidden; }
.preg-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--lime-2), #84ad68); }
.preg-card.urgent .preg-bar i { background: linear-gradient(90deg, #e4a18f, var(--rose)); }
.preg-meta { display: flex; justify-content: space-between; gap: 6px; font-size: 8.5px; color: var(--muted); }
.preg-meta strong { color: var(--ink-2); font-weight: 700; font-family: var(--font-num); }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 10px; }
.section-title h3 { font-size: 12px; font-weight: 800; }
.section-title p { font-size: 9.5px; color: var(--muted); margin-top: 2px; }

/* ---------- Health ---------- */
.health-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.health-card { padding: 13px 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); display: flex; gap: 10px; align-items: flex-start; }
.health-card .h-ico { width: 31px; height: 31px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; }
.health-card .h-ico .svg-ico { width: 16px; height: 16px; }
.health-card strong { display: block; font-size: 11px; line-height: 1.35; }
.health-card span { display: block; font-size: 8.8px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.h-ico.green { background: var(--green-soft); color: var(--green); }
.h-ico.amber { background: var(--amber-soft); color: var(--amber); }
.h-ico.rose { background: var(--rose-soft); color: var(--rose); }
.h-ico.blue { background: var(--blue-soft); color: var(--blue); }

/* ---------- Feed / inventory ---------- */
.feed-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; margin-bottom: 16px; }
.barn-bars { display: flex; flex-direction: column; gap: 11px; max-height: 300px; overflow-y: auto; padding-right: 4px; }
.barn-bar-row { display: grid; grid-template-columns: 68px 1fr 54px; gap: 8px; align-items: center; font-size: 9.5px; }
.barn-bar-row span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barn-bar { height: 7px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.barn-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #87a96b, var(--green)); }
.barn-bar-row strong { font-family: var(--font-num); text-align: right; font-size: 10px; font-weight: 700; }

.inventory-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.inv-card { padding: 15px 15px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.inv-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.inv-name { font-size: 11px; font-weight: 700; line-height: 1.35; }
.inv-cat { font-size: 8.5px; color: var(--muted); margin-top: 2px; }
.inv-qty { margin-top: 13px; display: flex; align-items: baseline; gap: 3px; }
.inv-qty strong { font-family: var(--font-num); font-size: 22px; line-height: 1; }
.inv-qty span { font-size: 8.5px; color: var(--muted); }
.inv-meter { height: 5px; border-radius: 5px; background: var(--surface-3); margin: 8px 0 6px; overflow: hidden; }
.inv-meter i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.inv-meter.low i { background: var(--rose); }
.inv-meter.warn i { background: var(--amber); }
.inv-meta { display: flex; align-items: center; justify-content: space-between; font-size: 8.5px; color: var(--muted); }
.pen-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pen-card[draggable="true"] { cursor: grab; }
.pen-card.dragging { opacity: .45; border-style: dashed; }
.pen-top-right { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.pen-drag { display: inline-flex; align-items: center; gap: 3px; font-size: 8px; color: var(--muted-2); white-space: nowrap; cursor: grab; touch-action: none; }
.pen-drag .svg-ico { width: 11px; height: 11px; }
.pen-actions { display: flex; gap: 5px; margin-top: 10px; border-top: 1px solid var(--line); padding-top: 9px; }
.report-grid.pen-report { align-items: stretch; }
.pen-report .card { display: flex; flex-direction: column; height: 430px; }
.pen-report .card-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pen-report .chart-box { flex: 1; height: auto; min-height: 224px; }
.pen-report .scroll-panel { flex: 1; min-height: 0; max-height: none !important; }
.tab-count { font-size: 8.5px; color: var(--muted); background: var(--surface-2); padding: 1px 5px; border-radius: 9px; margin-left: 2px; }
.batch-filters { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 10px; }
.batch-filter-search { position: relative; flex: 1 1 190px; min-width: 150px; display: flex; align-items: center; }
.batch-filter-search .svg-ico { position: absolute; left: 10px; width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.batch-filter-search .input { height: 34px; padding-left: 30px; font-size: 10.5px; }
.batch-filter-select { height: 34px; width: 140px; flex: 0 0 auto; font-size: 10px; }
.batch-filter-count { margin-left: auto; font-size: 9px; color: var(--muted); white-space: nowrap; }
.batch-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; max-height: 310px; overflow-y: auto; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.batch-check { display: flex; align-items: flex-start; gap: 7px; padding: 6px 8px; border-radius: 7px; font-size: 10px; line-height: 1.45; color: var(--ink-2); cursor: pointer; }
.batch-check:hover { background: #fff; }
.batch-check input { width: 13px; height: 13px; margin: 1px 0 0; accent-color: var(--green); flex: 0 0 auto; }
.batch-check span { min-width: 0; }
.stock-alert { display: inline-flex; align-items: center; gap: 3px; color: var(--rose); font-weight: 700; }
.stock-alert .svg-ico { width: 11px; height: 11px; }

/* ---------- Finance ---------- */
.fin-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; margin-bottom: 16px; align-items: start; }
.fin-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; margin-bottom: 16px; }
.fin-cell { padding: 17px 18px; border-right: 1px solid var(--line); }
.fin-cell:last-child { border-right: 0; }
.fin-cell span { font-size: 9.5px; color: var(--muted); }
.fin-cell strong { display: block; font-family: var(--font-num); font-size: 24px; line-height: 1.2; margin-top: 5px; }
.fin-cell small { display: block; font-size: 8.5px; color: var(--muted); margin-top: 3px; }
.fin-cell.positive strong { color: var(--green); }
.fin-cell.negative strong { color: var(--rose); }

/* ---------- Record Explorer ---------- */
.record-filter-card { margin-bottom: 12px; }
.record-filter-grid { display: grid; grid-template-columns: 138px 138px 158px 158px minmax(210px, 1fr); gap: 12px; align-items: end; }
.record-filter-grid .field { gap: 4px; }
.record-filter-grid .field label { font-size: 9.5px; }
.record-presets { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.preset-label { font-size: 9px; color: var(--muted); font-weight: 700; margin-right: 3px; }
.record-presets .spacer { flex: 1; }
.record-summary { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.record-summary .meta-pill strong { color: var(--ink); }
.record-detail { white-space: normal; min-width: 220px; max-width: 390px; line-height: 1.45; }
.record-detail strong { display: block; font-size: 10.5px; font-weight: 600; color: var(--ink-2); }
.record-detail small { display: block; font-size: 8.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.record-pager { display: flex; align-items: center; gap: 7px; }
.record-pager #records-page-info { font-family: var(--font-num); font-size: 9.5px; color: var(--muted); min-width: 44px; text-align: center; }
.record-pager .btn { height: 28px; padding: 0 9px; font-size: 9.5px; }

/* ---------- Reports ---------- */
.report-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); margin-bottom: 16px; flex-wrap: wrap; }
.report-range { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.report-range label { font-size: 9.5px; color: var(--muted); }
.report-range .input { width: 132px; height: 34px; font-family: var(--font-num); font-size: 10.5px; }
.report-cover { display: none; }
.report-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.report-metric { padding: 16px 17px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); position: relative; overflow: hidden; }
.report-metric span { display: flex; align-items: center; gap: 5px; font-size: 9.5px; color: var(--muted); }
.report-metric span .svg-ico { width: 12px; height: 12px; }
.report-metric strong { display: flex; align-items: baseline; gap: 4px; font-family: var(--font-num); font-size: 26px; line-height: 1.2; margin-top: 7px; font-weight: 700; }
.report-metric strong small { font-family: var(--font-sans); font-size: 9px; color: var(--muted); font-weight: 400; }
.report-metric p { font-size: 8.5px; color: var(--muted); margin-top: 2px; }
.report-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 16px; align-items: start; }
.report-note { font-size: 8.5px; color: var(--muted-2); line-height: 1.55; margin-top: 10px; }
.report-table th { background: #f5f3ea; }

/* ---------- Tasks ---------- */
.task-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.task-sum { padding: 14px 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); display: flex; align-items: center; gap: 11px; }
.task-sum-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; }
.task-sum-ico .svg-ico { width: 17px; height: 17px; }
.task-sum strong { display: block; font-family: var(--font-num); font-size: 22px; line-height: 1; }
.task-sum span { display: block; font-size: 9.5px; color: var(--muted); margin-top: 3px; }
.task-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; }
.reminder-list { display: flex; flex-direction: column; gap: 8px; max-height: 440px; overflow-y: auto; padding-right: 4px; }
.reminder-card { display: flex; gap: 10px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); position: relative; overflow: hidden; flex: 0 0 auto; min-width: 0; }
.reminder-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--amber); }
.reminder-card.high::before { background: var(--rose); }
.reminder-card.low::before { background: #9dae9a; }
.reminder-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto; background: var(--amber-soft); color: var(--amber); }
.reminder-card.high .reminder-ico { background: var(--rose-soft); color: var(--rose); }
.reminder-card .reminder-ico .svg-ico { width: 14px; height: 14px; }
.reminder-main { flex: 1; min-width: 0; }
.reminder-main strong { display: block; font-size: 10.5px; font-weight: 700; line-height: 1.4; }
.reminder-main p { font-size: 9px; color: var(--muted); margin-top: 2px; line-height: 1.45; overflow-wrap: anywhere; word-break: break-word; }
.reminder-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: 0 0 auto; }
.reminder-side time { font-size: 8.5px; color: var(--muted); white-space: nowrap; }
.calendar-strip { display: flex; gap: 7px; overflow-x: auto; padding: 2px 1px 8px; margin-bottom: 5px; }
.cal-day { flex: 0 0 61px; min-height: 76px; padding: 7px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-align: center; }
.cal-day.today { background: var(--green-deep); border-color: var(--green-deep); color: #fff; }
.cal-day.weekend { background: var(--surface-2); }
.cal-day.today.weekend { background: var(--green-deep); }
.cal-day .cal-w { font-size: 8px; color: var(--muted); }
.cal-day.today .cal-w { color: rgba(255,255,255,.55); }
.cal-day .cal-d { font-family: var(--font-num); font-size: 16px; font-weight: 700; line-height: 1.25; }
.cal-day .cal-dot { display: inline-flex; gap: 2px; margin-top: 4px; min-height: 5px; }
.cal-day .cal-dot i { width: 4px; height: 4px; border-radius: 50%; background: var(--amber); }
.cal-day .cal-dot i.rose { background: var(--rose); }
.cal-day .cal-dot i.green { background: #7ca06d; }
.cal-day.today .cal-dot i { background: var(--lime); }
.task-list { display: flex; flex-direction: column; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.task-row { display: flex; align-items: flex-start; gap: 10px; padding: 11px 0; border-bottom: 1px solid #f0ede2; flex: 0 0 auto; }
.task-row:last-child { border-bottom: 0; padding-bottom: 0; }
.task-row.done .task-main strong { text-decoration: line-through; color: var(--muted); }
.task-check { width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid #c9d0c3; background: #fff; display: grid; place-items: center; color: transparent; flex: 0 0 auto; margin-top: 1px; }
.task-check .svg-ico { width: 10px; height: 10px; }
.task-row.done .task-check { background: var(--green); border-color: var(--green); color: #fff; }
.task-main { flex: 1; min-width: 0; }
.task-main strong { display: block; font-size: 10.5px; font-weight: 600; }
.task-main p { font-size: 9px; color: var(--muted); margin-top: 2px; }
.task-tags { display: flex; gap: 4px; margin-left: auto; flex: 0 0 auto; }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; }
.settings-section + .settings-section { margin-top: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 10px; font-weight: 700; color: var(--ink-2); display: flex; align-items: center; gap: 4px; }
.field label em { font-style: normal; color: var(--rose); }
.field small { font-size: 8.5px; color: var(--muted); line-height: 1.45; }
.field .input, .field .select, .field .textarea { height: 39px; font-size: 11px; }
.field .textarea { height: auto; }
.unit-custom-input { margin-top: 8px; }
.field-row { display: flex; gap: 8px; }
.field-row > * { flex: 1; min-width: 0; }
.checkline { display: flex; align-items: flex-start; gap: 7px; font-size: 10px; color: var(--ink-2); line-height: 1.45; }
.checkline input { width: 14px; height: 14px; accent-color: var(--green); margin: 1px 0 0; flex: 0 0 auto; }
.form-note { padding: 9px 11px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 9px; color: var(--muted); line-height: 1.55; }
.form-note strong { color: var(--ink-2); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); }
.settings-side .card + .card { margin-top: 16px; }
.data-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 4px; }
.data-stat { padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.data-stat span { display: block; font-size: 8.5px; color: var(--muted); }
.data-stat strong { display: block; font-family: var(--font-num); font-size: 17px; line-height: 1.3; margin-top: 2px; }
.danger-zone { border-color: #efd5cf; background: #fffaf8; }
.danger-zone .card-head h3 { color: #a65045; }
.settings-actions { display: flex; flex-direction: column; gap: 8px; }
.settings-actions .btn { justify-content: flex-start; }
.about-box { text-align: center; padding: 8px 4px 4px; }
.about-logo { width: 46px; height: 46px; margin: 0 auto 9px; border-radius: 13px; overflow: hidden; }
.about-box strong { display: block; font-size: 12px; }
.about-box span { display: block; font-size: 8.5px; color: var(--muted); margin-top: 3px; }
.about-box p { font-size: 9px; color: var(--muted); line-height: 1.6; margin-top: 9px; }

/* ---------- Modal ---------- */
.modal-overlay, .drawer-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(9, 28, 20, 0.46);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 22px;
  animation: overlayIn 180ms ease both;
}
.modal-overlay { z-index: 110; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 600px; max-width: 100%; max-height: calc(100vh - 44px);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: 20px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 220ms cubic-bezier(.2,.8,.2,1) both;
  overflow: hidden;
}
.modal.wide { width: 760px; }
.modal.narrow { width: 440px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 20px 22px 15px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.modal-head p { font-size: 10px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.modal-close { width: 30px; height: 30px; border: 0; border-radius: 8px; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; flex: 0 0 auto; }
.modal-close:hover { background: var(--surface-3); color: var(--ink); }
.modal-close .svg-ico { width: 15px; height: 15px; }
.modal-body { padding: 19px 22px; overflow-y: auto; }
.modal-body.no-pad { padding: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: #fbfaf4; }

/* ---------- Drawer ---------- */
.drawer-overlay { justify-content: flex-end; padding: 0; }
.drawer {
  width: 500px; max-width: 100%; height: 100%;
  background: var(--surface); box-shadow: -20px 0 60px rgba(9,28,20,.17);
  display: flex; flex-direction: column;
  animation: drawerIn 240ms cubic-bezier(.2,.8,.2,1) both;
}
@keyframes drawerIn { from { transform: translateX(24px); opacity: .5; } to { transform: none; opacity: 1; } }
.drawer-head { padding: 20px 22px 16px; border-bottom: 1px solid var(--line); position: relative; }
.drawer-head .modal-close { position: absolute; top: 18px; right: 19px; }
.drawer-body { padding: 18px 22px 30px; overflow-y: auto; flex: 1; }
.drawer-title { display: flex; align-items: center; gap: 11px; padding-right: 35px; }
.drawer-title .pig-avatar { width: 44px; height: 44px; border-radius: 13px; font-size: 12px; }
.drawer-title h2 { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.drawer-title p { font-size: 9.5px; color: var(--muted); margin-top: 2px; }
.drawer-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 15px 0 0; }
.drawer-metric { padding: 9px 10px; background: var(--surface-2); border-radius: 9px; border: 1px solid var(--line); }
.drawer-metric span { display: block; font-size: 8px; color: var(--muted); }
.drawer-metric strong { display: block; font-family: var(--font-num); font-size: 14px; margin-top: 2px; }
.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.info-cell { padding: 10px 12px; border-bottom: 1px solid #efecdf; border-right: 1px solid #efecdf; }
.info-cell:nth-child(2n) { border-right: 0; }
.info-cell:nth-last-child(-n+2) { border-bottom: 0; }
.info-cell span { display: block; font-size: 8.5px; color: var(--muted); }
.info-cell strong { display: block; font-size: 10.5px; font-weight: 600; margin-top: 2px; }
.timeline { position: relative; margin-top: 7px; max-height: 430px; overflow-y: auto; padding-right: 6px; }
.timeline-item { position: relative; display: grid; grid-template-columns: 22px 1fr auto; gap: 9px; padding-bottom: 17px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ""; position: absolute; left: 10px; top: 20px; bottom: 0; width: 1px; background: #e8e4d7; }
.timeline-item:last-child::before { display: none; }
.tl-dot { width: 21px; height: 21px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); position: relative; z-index: 1; }
.tl-dot .svg-ico { width: 11px; height: 11px; }
.tl-dot.green { background: var(--green-soft); color: var(--green); }
.tl-dot.amber { background: var(--amber-soft); color: var(--amber); }
.tl-dot.rose { background: var(--rose-soft); color: var(--rose); }
.tl-dot.blue { background: var(--blue-soft); color: var(--blue); }
.tl-main { min-width: 0; padding-top: 1px; }
.tl-main strong { display: block; font-size: 10.5px; font-weight: 700; line-height: 1.4; }
.tl-main p { font-size: 9px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.timeline time { font-family: var(--font-num); font-size: 8.5px; color: var(--muted); white-space: nowrap; padding-top: 2px; }

/* ---------- Toast ---------- */
.toast-root { position: fixed; right: 22px; bottom: 22px; z-index: 160; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  min-width: 220px; max-width: 360px;
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 13px; border-radius: 11px;
  background: var(--green-deep); color: #f7f9ee;
  box-shadow: 0 14px 32px rgba(9,28,20,.23);
  font-size: 10.5px; line-height: 1.45;
  animation: toastIn 220ms cubic-bezier(.2,.8,.2,1) both;
  pointer-events: auto;
}
.toast.error { background: #6f2e27; }
.toast.warn { background: #7a541f; }
.toast .toast-ico { width: 17px; height: 17px; flex: 0 0 auto; color: var(--lime); margin-top: 1px; }
.toast.error .toast-ico, .toast.warn .toast-ico { color: #ffe0a3; }
.toast.out { animation: toastOut 180ms ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* ---------- Utility ---------- */
.muted { color: var(--muted); }
.small { font-size: 10px; }
.mono { font-family: var(--font-num); }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.inline-flex { display: inline-flex; align-items: center; gap: 5px; }
.text-green { color: var(--green); }
.text-rose { color: var(--rose); }
.text-amber { color: var(--amber); }
.text-right { text-align: right; }
.w-full { width: 100%; }
.mt-0 { margin-top: 0 !important; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.hide { display: none !important; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; background: var(--green-deep); color: white; z-index: 999; }

/* ---------- Responsive ---------- */
@media (max-width: 1320px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid.three { grid-template-columns: 1fr 1fr; }
  .dash-grid.three > :last-child { grid-column: 1 / -1; }
  .inventory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pen-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pen-report .card { height: auto; }
  .pen-report .chart-box { flex: none; height: 224px; }
  .pen-report .scroll-panel { flex: none; max-height: 280px !important; }
  .health-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record-keyword { grid-column: 1 / -1; }
}
@media (max-width: 1180px) {
  :root { --sidebar-w: 246px; }
  .view { padding: 24px 24px 44px; }
  .topbar { padding: 0 24px; }
  .global-search { width: 210px; }
  .hero-side { display: none; }
  .preg-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid, .dash-grid.equal, .feed-grid, .fin-grid, .report-grid, .settings-grid, .task-grid { grid-template-columns: 1fr; }
  .structure-wrap { justify-content: center; }
  .structure-list { max-width: 240px; }
  .task-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-grid .card:last-child { margin-top: 0; }
}
@media (max-width: 980px) {
  :root { --sidebar-w: 268px; }
  .sidebar { transform: translateX(-102%); transition: transform 260ms cubic-bezier(.2,.8,.2,1); box-shadow: 20px 0 60px rgba(0,0,0,.15); }
  body.nav-open .sidebar { transform: none; }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(9,28,20,.42); opacity: 0; visibility: hidden; transition: opacity 220ms ease, visibility 220ms; }
  body.nav-open .sidebar-backdrop { opacity: 1; visibility: visible; }
  .main { margin-left: 0; }
  .menu-btn { display: grid !important; }
  .topbar { height: 68px; }
  .view { padding: 22px 20px 42px; }
  .topbar { padding: 0 20px; }
  .global-search { display: none; }
  .profile-copy { display: none; }
  .hero { padding: 23px 24px; }
  .hero h1 { font-size: 24px; }
}
@media (max-width: 760px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px 14px 12px; }
  .kpi-value strong { font-size: 25px; }
  .kpi-icon { width: 30px; height: 30px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .page-head h1 { font-size: 24px; }
  .page-sub { font-size: 11px; }
  .hero { padding: 20px; border-radius: 18px; }
  .hero h1 { font-size: 21px; }
  .hero-sub { font-size: 10.5px; }
  .hero-actions .btn { height: 35px; font-size: 10.5px; }
  .dash-grid.three { grid-template-columns: 1fr; }
  .dash-grid.three > :last-child { grid-column: auto; }
  .structure-wrap { flex-direction: column; }
  .structure-list { width: 100%; max-width: none; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .donut-box { width: 140px; height: 140px; flex-basis: 140px; }
  .preg-board { grid-template-columns: 1fr; }
  .fin-summary { grid-template-columns: 1fr; }
  .fin-cell { border-right: 0; border-bottom: 1px solid var(--line); }
  .fin-cell:last-child { border-bottom: 0; }
  .report-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-toolbar { align-items: flex-start; flex-direction: column; }
  .health-strip { grid-template-columns: 1fr; }
  .inventory-grid { grid-template-columns: 1fr; }
  .pen-grid { grid-template-columns: 1fr; }
  .task-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record-filter-grid { grid-template-columns: 1fr; }
  .record-keyword { grid-column: auto; }
  .batch-list { grid-template-columns: 1fr; max-height: 260px; }
  .batch-filter-select { flex: 1 1 calc(50% - 4px); width: auto; }
  .batch-filter-count { width: 100%; margin-left: 0; }
  .record-presets .spacer { display: none; }
  .record-detail { min-width: 185px; max-width: 250px; }
  .record-pager { margin-left: auto; }
  .settings-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { width: 100% !important; max-width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; animation: sheetIn 240ms cubic-bezier(.2,.8,.2,1) both; }
  @keyframes sheetIn { from { transform: translateY(34px); opacity: .6; } to { transform: none; opacity: 1; } }
  .drawer { width: 100%; }
  .toast-root { left: 14px; right: 14px; bottom: 14px; }
  .toast { width: 100%; max-width: none; }
  .page-head .page-actions .btn { flex: 1; }
  .topbar-actions { gap: 7px; }
  .quick-menu { position: fixed; left: 14px; right: 14px; top: 68px; width: auto; }
  .quick-menu::before { display: none; }
  .quick-add summary span:last-child { display: none; }
  .quick-add summary { width: 38px; padding: 0; }
  .profile { display: none; }
  .crumb span, .crumb i { display: none; }
  .crumb strong { font-size: 13px; }
  .data-table { min-width: 620px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .card-head { padding: 16px 16px 0; }
  .card-body { padding: 14px 16px 17px; }
}
@media (max-width: 460px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-value strong { font-size: 22px; }
  .kpi-label { font-size: 9.5px; }
  .kpi-foot { font-size: 8.5px; }
  .view { padding: 18px 14px 38px; }
  .topbar { padding: 0 14px; }
  .hero-date { font-size: 8.5px; }
  .hero h1 { font-size: 19px; }
  .hero { padding: 17px; }
  .attention { align-items: flex-start; }
  .attention-link { display: none; }
  .report-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .report-metric { padding: 13px; }
  .report-metric strong { font-size: 21px; }
  .task-summary { gap: 8px; }
  .task-sum { padding: 11px; }
  .task-sum strong { font-size: 18px; }
  .toolbar-search { width: 100%; }
  .toolbar-search .input { width: 100%; }
  .toolbar { width: 100%; }
  .toolbar > .select { flex: 1; min-width: 120px; }
}

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

/* ---------- Print ---------- */
@media print {
  .scroll-panel, .barn-bars, .reminder-list, .task-list, .activity-list, .timeline, .barn-list-scroll {
    max-height: none !important;
    overflow: visible !important;
    padding-right: 0 !important;
  }
  @page { size: A4 landscape; margin: 11mm; }
  body { background: #fff; color: #111; font-size: 10pt; }
  .sidebar, .topbar, .page-head, .page-actions, .report-toolbar, .sidebar-backdrop, .toast-root, .modal-overlay, .drawer-overlay, .no-print { display: none !important; }
  .main { margin-left: 0; }
  .view { padding: 0; max-width: none; }
  .page { animation: none; }
  .report-cover { display: block; padding-bottom: 8mm; border-bottom: 1px solid #ccc; margin-bottom: 5mm; }
  .report-cover h1 { font-size: 19pt; margin: 0 0 2mm; }
  .report-cover p { font-size: 8.5pt; color: #555; }
  .report-cover .cover-meta { display: flex; gap: 8mm; margin-top: 3mm; font-size: 8pt; color: #444; }
  .card, .report-metric, .fin-summary { box-shadow: none !important; border-color: #ddd !important; break-inside: avoid; }
  .report-grid { grid-template-columns: 1fr 1fr; gap: 5mm; }
  .report-cards { gap: 4mm; }
  .report-metric strong { font-size: 18pt; }
  .chart-box { height: 58mm !important; }
  .data-table { font-size: 7.5pt; }
  .data-table th, .data-table td { padding: 4px 5px; }
  .card-head { padding-top: 4mm; }
  .card-body { padding: 3mm 4mm 4mm; }
  .page-head { margin-bottom: 4mm; }
  .page-head h1 { font-size: 18pt; }
  .report-note { color: #666; }
}

.overlay-open { overflow: hidden; }
