/* =====================================================================
   Components — shell, sidebar, cards, tables, forms, modals, etc.
   ===================================================================== */

/* ============ APP SHELL ============ */
.app { min-height: 100vh; }

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ============ SIDEBAR ============ */
.sidebar {
  background: linear-gradient(180deg, #0c2f2b, #15514a 55%, #103e39);
  color: #dce7e3;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 18px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.brand__mark {
  width: 46px; height: 46px;
  border-radius: 13px;
  display: grid; place-content: center;
  font-weight: 900; font-size: 1.15rem;
  color: #0c2f2b;
  background: linear-gradient(145deg, #e7c75a, var(--gold));
  box-shadow: 0 6px 16px rgba(201, 162, 39, 0.3);
  flex-shrink: 0;
}
.brand__mark svg { width: 26px; height: 26px; stroke-width: 1.9; }
.brand__txt b { color: #fff; font-size: 1rem; display: block; line-height: 1.25; }
.brand__txt span { font-size: var(--fs-xs); color: #9fc0b9; }

.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.nav__item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px;
  border-radius: var(--r-md);
  color: #cfe0db;
  font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
  border: none; background: none; width: 100%; text-align: start;
}
.nav__item svg { width: 20px; height: 20px; flex-shrink: 0; opacity: 0.9; }
.nav__item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav__item.active {
  background: linear-gradient(90deg, rgba(201,162,39,0.95), rgba(201,162,39,0.75));
  color: #0c2f2b;
  font-weight: 700;
  box-shadow: var(--sh-sm);
}
.nav__item.active svg { opacity: 1; }
.nav__sep { font-size: var(--fs-xs); color: #7fa39b; padding: 14px 13px 5px; letter-spacing: .5px; }

.sidebar__foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.userchip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-md); }
.userchip__av {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.12); color: #fff;
  display: grid; place-content: center; font-weight: 800; flex-shrink: 0;
}
.userchip__txt b { color: #fff; font-size: var(--fs-sm); display: block; }
.userchip__txt span { font-size: var(--fs-xs); color: #9fc0b9; }

/* ============ TOPBAR / MAIN ============ */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h);
  background: rgba(250, 247, 240, 0.85);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  position: sticky; top: 0; z-index: 50;
}
.topbar h1 { font-size: var(--fs-xl); }
.topbar__sub { font-size: var(--fs-xs); color: var(--ink-faint); margin-top: 2px; }
.burger { display: none; background: none; border: none; padding: 6px; border-radius: 8px; }
.burger svg { width: 26px; height: 26px; color: var(--green); }

.content { padding: 22px; max-width: var(--maxw); width: 100%; margin: 0 auto; }
.page-head { margin-bottom: 18px; }
.page-head h2 { font-size: var(--fs-2xl); }
.page-head p { color: var(--ink-soft); font-size: var(--fs-sm); }

/* ============ CARDS ============ */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  padding: 18px;
}
.card--pad-lg { padding: 24px; }
.card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card__head h3 { font-size: var(--fs-lg); }

.grid { display: grid; gap: 16px; }
/* Allow grid children to shrink below content width so inner overflow-x
   (e.g. wide tables/charts) scrolls instead of stretching the page. */
.grid > * { min-width: 0; }
canvas { max-width: 100%; }
.grid--kpi { grid-template-columns: repeat(4, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--cards { grid-template-columns: repeat(auto-fill, minmax(265px, 1fr)); }
@media (max-width: 1000px) { .grid--kpi { grid-template-columns: repeat(2, 1fr); } .grid--3 { grid-template-columns: 1fr; } }
@media (max-width: 900px)  { .grid--2 { grid-template-columns: 1fr; } }
@media (max-width: 560px)  { .grid--kpi { grid-template-columns: 1fr; } }

/* ============ KPI ============ */
.kpi {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--sh-sm);
  position: relative;
  overflow: hidden;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.kpi::after {
  content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0;
  width: 5px; background: var(--green);
}
.kpi--gold::after { background: var(--gold); }
.kpi--late::after { background: var(--late); }
.kpi--warn::after { background: var(--warn); }
.kpi--ok::after { background: var(--ok); }
.kpi__icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-content: center; margin-bottom: 12px;
  background: var(--green-soft); color: var(--green);
}
.kpi--gold .kpi__icon { background: var(--gold-soft); color: var(--gold-600); }
.kpi--late .kpi__icon { background: var(--late-bg); color: var(--late); }
.kpi--warn .kpi__icon { background: var(--warn-bg); color: var(--warn); }
.kpi--ok .kpi__icon { background: var(--ok-bg); color: var(--ok); }
.kpi__icon svg { width: 22px; height: 22px; }
.kpi__val { font-size: var(--fs-3xl); font-weight: 900; line-height: 1; }
.kpi__label { font-size: var(--fs-sm); color: var(--ink-soft); margin-top: 6px; }
.kpi__sub { font-size: var(--fs-xs); color: var(--ink-faint); margin-top: 4px; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-weight: 700; font-size: var(--fs-sm);
  transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--green); color: #fff; box-shadow: var(--sh-sm); }
.btn--primary:hover { background: var(--green-600); box-shadow: var(--sh-md); }
.btn--gold { background: var(--gold); color: #2a2206; }
.btn--gold:hover { background: var(--gold-600); color:#fff; }
.btn--ghost { background: var(--white); color: var(--green); border-color: var(--line); }
.btn--ghost:hover { background: var(--green-tint); border-color: var(--green-soft); }
.btn--tg { background: var(--tg); color: #fff; }
.btn--tg:hover { background: var(--tg-600); }
.btn--danger { background: var(--late-bg); color: var(--late); }
.btn--danger:hover { background: #f5d6d2; }
.btn--sm { padding: 7px 11px; font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn--icon { padding: 8px; border-radius: var(--r-sm); }
.btn--block { width: 100%; }

/* ============ BADGES / PILLS ============ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 700;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--ok   { background: var(--ok-bg);   color: var(--ok); }
.badge--soon { background: var(--warn-bg); color: var(--warn); }
.badge--late { background: var(--late-bg); color: var(--late); }
.badge--done { background: var(--ok-bg);   color: var(--ok); }
.badge--neutral { background: var(--cream-2); color: var(--ink-soft); }
.badge--gold { background: var(--gold-soft); color: var(--gold-600); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--r-pill);
  background: var(--green-tint); color: var(--green);
  font-size: var(--fs-xs); font-weight: 600; border: 1px solid var(--green-soft);
}

/* ============ TABLES ============ */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--line); background:var(--white); }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); min-width: 640px; }
table.tbl thead th {
  background: var(--green-tint);
  color: var(--green-700);
  font-weight: 700;
  text-align: start;
  padding: 13px 14px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
}
table.tbl tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr { transition: background var(--t-fast); }
table.tbl tbody tr:hover { background: var(--green-tint); }
table.tbl .td-actions { display: flex; gap: 6px; }
.tag-mono { font-weight: 800; color: var(--green-700); }

/* ============ FORMS ============ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-soft); }
.field .hint { font-size: var(--fs-xs); color: var(--ink-faint); }
.input, .select, .textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--white);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(28, 99, 89, 0.12);
}
.textarea { resize: vertical; min-height: 84px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.form-row-actions { display: flex; gap: 10px; justify-content: flex-start; margin-top: 6px; }

/* Filter bar */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-bottom: 16px;
}
.toolbar .select, .toolbar .input { width: auto; min-width: 150px; }
.toolbar .grow-input { flex: 1; min-width: 180px; }
.segment { display: inline-flex; background: var(--cream-2); border-radius: var(--r-md); padding: 3px; gap: 2px; }
.segment button {
  border: none; background: none; padding: 7px 13px; border-radius: var(--r-sm);
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink-soft);
  transition: all var(--t-fast);
}
.segment button.on { background: var(--white); color: var(--green); box-shadow: var(--sh-sm); }

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(12, 47, 43, 0.42);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  padding: 16px;
  animation: fade var(--t-fast);
}
.modal {
  background: var(--white);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  width: min(560px, 100%);
  max-height: 90vh; overflow-y: auto;
  animation: pop var(--t-mid);
}
.modal--wide { width: min(760px, 100%); }
.modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--white); z-index: 1;
}
.modal__head h3 { font-size: var(--fs-lg); }
.modal__body { padding: 22px; }
.modal__foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-start; }
.x-btn { background: none; border: none; padding: 6px; border-radius: 8px; color: var(--ink-soft); transition: background var(--t-fast); }
.x-btn:hover { background: var(--cream-2); }
.x-btn svg { width: 22px; height: 22px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* ============ TOAST ============ */
.toast-root {
  position: fixed; inset-block-start: 18px; inset-inline-end: 18px; z-index: 500;
  display: flex; flex-direction: column; gap: 10px; max-width: 360px;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--white); border: 1px solid var(--line);
  border-inline-start: 4px solid var(--green);
  border-radius: var(--r-md); padding: 13px 15px; box-shadow: var(--sh-lg);
  animation: slidein var(--t-mid);
}
.toast--ok   { border-inline-start-color: var(--ok); }
.toast--err  { border-inline-start-color: var(--late); }
.toast--tg   { border-inline-start-color: var(--tg); }
.toast svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 2px; }
.toast--ok svg { color: var(--ok); }
.toast--err svg { color: var(--late); }
.toast--tg svg { color: var(--tg); }
.toast b { display: block; font-size: var(--fs-sm); }
.toast span { font-size: var(--fs-xs); color: var(--ink-soft); }
@keyframes slidein { from { opacity: 0; transform: translateX(-16px); } }

/* ============ TIMELINE ============ */
.timeline { position: relative; padding-inline-start: 26px; }
.timeline::before {
  content: ""; position: absolute; inset-inline-start: 7px; top: 6px; bottom: 6px;
  width: 2px; background: var(--line);
}
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item::before {
  content: ""; position: absolute; inset-inline-start: -23px; top: 4px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--white); border: 3px solid var(--green);
}
.tl-item--done::before { border-color: var(--ok); background: var(--ok); }
.tl-item--late::before { border-color: var(--late); background: var(--late); }
.tl-item--soon::before { border-color: var(--warn); background: var(--warn); }
.tl-item--move::before { border-color: var(--gold); background: var(--gold); }
.tl-date { font-size: var(--fs-xs); color: var(--ink-faint); }
.tl-title { font-weight: 700; }
.tl-note { font-size: var(--fs-sm); color: var(--ink-soft); }

/* ============ EMPTY / LOADING ============ */
.empty { text-align: center; padding: 48px 20px; color: var(--ink-faint); }
.empty svg { width: 52px; height: 52px; opacity: .4; margin: 0 auto 12px; }
.empty b { display: block; color: var(--ink-soft); font-size: var(--fs-lg); margin-bottom: 4px; }
.skeleton {
  background: linear-gradient(90deg, #efe9dc 25%, #f6f2e9 37%, #efe9dc 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.spin-sm { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }

/* ============ CALF CARD ============ */
.calf-card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-sm); overflow: hidden; transition: transform var(--t-fast), box-shadow var(--t-fast);
  cursor: pointer; display: flex; flex-direction: column;
}
.calf-card:hover { transform: translateY(-3px); box-shadow: var(--sh-md); }
.calf-card__top {
  background: linear-gradient(135deg, var(--green-tint), var(--cream));
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
}
.calf-card__tag { font-weight: 900; color: var(--green-700); font-size: var(--fs-lg); }
.calf-card__body { padding: 14px 16px; display: flex; flex-direction: column; gap: 9px; }
.calf-meta { display: flex; align-items: center; gap: 7px; font-size: var(--fs-sm); color: var(--ink-soft); }
.calf-meta svg { width: 16px; height: 16px; color: var(--gold-600); flex-shrink: 0; }
.calf-card__foot { margin-top: auto; padding: 12px 16px; border-top: 1px solid var(--line-soft); display: flex; justify-content: space-between; align-items: center; }

/* ============ STAT / MISC ============ */
.donut-legend { display: flex; flex-direction: column; gap: 10px; }
.donut-legend li { display: flex; align-items: center; gap: 9px; font-size: var(--fs-sm); }
.dot { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }
.alert-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.alert-row:last-child { border-bottom: none; }
.alert-row__icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-content: center; flex-shrink: 0; }

/* Dashboard: upcoming vaccinations grouped by station → barn */
.st-alerts { display: flex; flex-direction: column; gap: 10px; }
.st-alert { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--white); }
.st-alert__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 13px; background: var(--green-tint); flex-wrap: wrap; }
.st-alert__title { display: flex; align-items: center; gap: 8px; color: var(--green-700); font-weight: 700; min-width: 0; }
.st-alert__title svg { width: 19px; height: 19px; flex-shrink: 0; }
.st-alert__barn { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 13px; border-top: 1px solid var(--line-soft); }
.st-alert__barnname { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.st-alert__barnname svg { width: 16px; height: 16px; color: var(--ink-faint); flex-shrink: 0; }
.st-alert__barnname .muted { font-size: var(--fs-xs); }
.st-alert__types { font-size: 0.76rem; margin-top: 3px; color: var(--ink-faint); line-height: 1.5; }
/* Mobile: stack the station/barn rows so names + types + badges each get the
   full width instead of being squeezed by space-between (which wraps text
   character-by-character on narrow screens). */
@media (max-width: 560px) {
  .st-alert__head { gap: 6px 8px; }
  .st-alert__head .sc-pills { flex: 1 1 100%; margin-inline-start: 0; }
  .st-alert__barn { flex-wrap: wrap; gap: 7px; }
  .st-alert__barn > .grow { flex: 1 1 100%; min-width: 0; }
  .st-alert__barn .sc-pills { flex: 1 1 100%; margin-inline-start: 0; }
  .st-alert__barnname b { white-space: nowrap; }
}

.def-list { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; font-size: var(--fs-sm); }
.def-list dt { color: var(--ink-faint); }
.def-list dd { font-weight: 600; }

/* ============ CALENDAR ============ */
.cal-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.cal-legend { display: flex; gap: 12px; }
.cal-legend li { display: flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--ink-soft); }
.cal-scroll { overflow-x: auto; }
.cal-scroll-inner { min-width: 560px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-mini { display: none; flex-wrap: wrap; gap: 3px; }
.cal-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.cal-dot--late { background: var(--late); }
.cal-dot--soon { background: var(--warn); }
.cal-dot--done { background: var(--ok); }
.cal-more-n { font-size: .6rem; font-weight: 800; color: var(--ink-faint); }
.cal-dow { font-size: var(--fs-xs); color: var(--ink-faint); text-align: center; font-weight: 700; padding: 4px 0; }
.cal-cell { min-height: 86px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--white); padding: 7px; display: flex; flex-direction: column; gap: 5px; transition: box-shadow var(--t-fast), transform var(--t-fast); }
.cal-cell.out { background: var(--cream-2); opacity: .45; }
.cal-cell.today { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }
.cal-cell.has { cursor: pointer; }
.cal-cell.has:hover { box-shadow: var(--sh-md); transform: translateY(-1px); }
.cal-day { font-size: var(--fs-sm); font-weight: 700; color: var(--ink-soft); }
.cal-dots { display: flex; flex-direction: column; gap: 3px; margin-top: auto; }
.cal-pill { font-size: .64rem; padding: 2px 6px; border-radius: 5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-pill--late { background: var(--late-bg); color: var(--late); }
.cal-pill--soon { background: var(--warn-bg); color: var(--warn); }
.cal-pill--done { background: var(--ok-bg); color: var(--ok); }
.cal-pill--more { background: var(--cream-2); color: var(--ink-soft); }

/* ============ ATTACHMENTS ============ */
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
.attach { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--white); transition: box-shadow var(--t-fast); }
.attach:hover { box-shadow: var(--sh-md); }
.attach__thumb { display: block; height: 98px; background: var(--green-tint); }
.attach__thumb img { width: 100%; height: 100%; object-fit: cover; }
.attach__file { height: 100%; display: grid; place-content: center; color: var(--gold-600); }
.attach__file svg { width: 34px; height: 34px; }
.attach__meta { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line-soft); }
.attach__name { font-size: .74rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach__del { border: none; background: none; color: var(--late); padding: 3px; border-radius: 6px; }
.attach__del:hover { background: var(--late-bg); }
.attach__del svg { width: 16px; height: 16px; }

/* ============ MOVEMENT LOG (elder-friendly, phone-first) ============ */
/* Big readable cards instead of a horizontal table. Each card reads as a
   short sentence: which calf, when, from → to, why, who recorded it. */
.mv-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 6px; }
.mv-add { font-size: var(--fs-md); padding: 14px 22px; }
.mv-add svg { width: 21px; height: 21px; }
.mv-filter {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 5px 14px;
}
.mv-filter__lbl { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
.mv-filter__lbl svg { width: 18px; height: 18px; color: var(--gold-600); }
.mv-filter__sel { border: none; background: none; font-size: var(--fs-md); font-weight: 700; color: var(--green-700); padding: 9px 4px; min-width: 130px; }
.mv-filter__sel:focus { box-shadow: none; outline: none; }
.mv-count { color: var(--ink-faint); font-size: var(--fs-sm); font-weight: 600; margin: 8px 2px 14px; }

.mv-list { display: flex; flex-direction: column; gap: 14px; }
.mv-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-sm); padding: 16px 16px 14px; }
.mv-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.mv-card__calf { display: flex; align-items: center; gap: 12px; color: var(--ink); min-width: 0; }
.mv-card__calf:hover { color: var(--green-700); }
.mv-card__calf-ic { width: 46px; height: 46px; border-radius: 13px; background: var(--green-soft); color: var(--green); display: grid; place-content: center; flex-shrink: 0; }
.mv-card__calf-ic svg { width: 26px; height: 26px; }
.mv-card__calf-tag { display: block; font-size: var(--fs-lg); font-weight: 900; color: var(--green-700); }
.mv-card__date { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ink-faint); margin-top: 2px; }
.mv-card__date svg { width: 15px; height: 15px; }
.mv-card__del { background: var(--late-bg); color: var(--late); border: none; border-radius: var(--r-md); width: 46px; height: 46px; display: grid; place-content: center; flex-shrink: 0; transition: transform var(--t-fast); }
.mv-card__del svg { width: 22px; height: 22px; }
.mv-card__del:active { transform: scale(.93); }

.mv-route { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.mv-loc { background: var(--cream); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 12px 12px; text-align: center; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mv-loc--to { background: var(--gold-tint); border-color: var(--gold-soft); }
.mv-loc__label { font-size: var(--fs-xs); font-weight: 700; color: var(--ink-faint); }
.mv-loc--to .mv-loc__label { color: var(--gold-600); }
.mv-loc__place { font-size: var(--fs-lg); font-weight: 800; color: var(--ink); line-height: 1.25; }
.mv-loc__sub { font-size: var(--fs-sm); color: var(--ink-soft); }
.mv-route__arrow { width: 40px; height: 40px; border-radius: 50%; background: var(--gold); color: #2a2206; display: grid; place-content: center; box-shadow: var(--sh-sm); }
.mv-route__arrow svg { width: 22px; height: 22px; stroke-width: 2.4; }

.mv-card__foot { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.mv-fact { display: flex; flex-direction: column; gap: 1px; }
.mv-fact__k { font-size: var(--fs-xs); color: var(--ink-faint); font-weight: 600; }
.mv-fact__v { font-size: var(--fs-md); font-weight: 700; color: var(--ink); }

/* Big controls (also reused by the simplified movement form) */
.select--lg, .input.select--lg { padding: 14px 14px; font-size: var(--fs-md); }
.btn--lg { padding: 14px 22px; font-size: var(--fs-md); }
.btn--lg svg { width: 21px; height: 21px; }

/* Simplified movement form */
.mv-form .mv-lbl { display: block; font-size: var(--fs-md); font-weight: 800; color: var(--green-700); margin: 4px 0 9px; }
.mv-now { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--green-tint); border: 1px solid var(--green-soft); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 18px; }
.mv-now__lbl { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 700; color: var(--green); }
.mv-now__lbl svg { width: 18px; height: 18px; }
.mv-now__val { font-size: var(--fs-lg); font-weight: 800; color: var(--green-800); }
.reason-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.reason-chip { background: var(--white); border: 1.5px solid var(--line); border-radius: var(--r-pill); padding: 11px 17px; font-size: var(--fs-sm); font-weight: 700; color: var(--ink-soft); transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast); }
.reason-chip:hover { border-color: var(--green-soft); background: var(--green-tint); }
.reason-chip.on { background: var(--green); border-color: var(--green); color: #fff; }

@media (max-width: 600px) {
  .mv-add { width: 100%; justify-content: center; }
  .mv-filter { width: 100%; }
  .mv-filter__sel { flex: 1; }
  .mv-loc { padding: 11px 8px; }
  .mv-loc__place { font-size: var(--fs-md); }
  .mv-route { gap: 6px; }
  .mv-route__arrow { width: 34px; height: 34px; }
  .mv-route__arrow svg { width: 18px; height: 18px; }
  .modal__foot { flex-direction: column; }
  .modal__foot .btn { width: 100%; }
}

/* ============ VACCINE CATALOG (inline interval edit) ============ */
.vx-cat { display: flex; flex-direction: column; gap: 10px; }
.vx-item { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; background: var(--white); }
.vx-item__name { font-weight: 700; color: var(--ink); margin-bottom: 10px; }
.vx-item__ctrl { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.vx-item__field { display: flex; flex-direction: column; gap: 4px; }
.vx-item__field span { font-size: var(--fs-xs); color: var(--ink-faint); font-weight: 600; }
.vx-days { width: 96px; text-align: center; font-weight: 800; font-size: var(--fs-md); }

/* ============ HERD GROUP-BY-BARN ============ */
.herd-group { margin-bottom: 22px; }
.herd-group__head {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 12px;
  background: var(--green-tint); border: 1px solid var(--green-soft);
  border-radius: var(--r-md);
}
.herd-group__head svg { width: 20px; height: 20px; color: var(--green); }
.herd-group__head b { font-size: var(--fs-lg); color: var(--green-700); }
.herd-group__head .muted { font-size: var(--fs-sm); }
.herd-group__head .chip { margin-inline-start: auto; }

/* ============ HELP / USER GUIDE ============ */
.help-intro {
  background: linear-gradient(135deg, var(--green-tint), var(--cream));
  border: 1px solid var(--green-soft); border-radius: var(--r-lg);
  padding: 20px 22px; margin-bottom: 22px;
}
.help-intro h2 { font-size: var(--fs-2xl); color: var(--green-700); margin-bottom: 6px; }
.help-intro p { color: var(--ink-soft); font-size: var(--fs-md); }
.help-step {
  display: flex; gap: 16px; align-items: flex-start;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-sm); padding: 18px; margin-bottom: 16px;
}
.help-step__num {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%;
  background: var(--gold); color: #2a2206;
  display: grid; place-content: center; font-weight: 900; font-size: 1.25rem;
}
.help-step__body { flex: 1; min-width: 0; }
.help-step__body h3 { font-size: var(--fs-lg); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.help-step__body h3 svg { width: 22px; height: 22px; color: var(--green); }
.help-step__body p { color: var(--ink-soft); font-size: var(--fs-md); line-height: 1.8; }
.help-step__shot { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--cream-2); }
.help-step__shot img { width: 100%; display: block; }
.help-step__shot figcaption { font-size: var(--fs-sm); color: var(--ink-faint); padding: 7px 12px; text-align: center; background: var(--white); border-top: 1px solid var(--line-soft); }
.help-tip { display: flex; gap: 10px; align-items: flex-start; background: var(--gold-tint); border: 1px solid var(--gold-soft); border-radius: var(--r-md); padding: 12px 14px; margin: 8px 0 0; font-size: var(--fs-sm); color: var(--ink-soft); }
.help-tip svg { width: 19px; height: 19px; color: var(--gold-600); flex-shrink: 0; margin-top: 1px; }

/* About box */
.about-card { text-align: center; }
.about-logo { width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 14px; display: grid; place-content: center; background: linear-gradient(145deg, #e7c75a, var(--gold)); color: #0c2f2b; }
.about-logo svg { width: 40px; height: 40px; }
.about-row { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 9px 0; border-top: 1px solid var(--line-soft); font-size: var(--fs-md); }
.about-row:first-of-type { border-top: none; }
.about-row svg { width: 18px; height: 18px; color: var(--gold-600); }
.about-row a { font-weight: 700; }

@media (max-width: 600px) {
  .help-step { padding: 14px; gap: 12px; }
  .help-step__num { width: 38px; height: 38px; font-size: 1.1rem; }
}

/* ============ REPORT PREVIEW (modal) ============ */
.report-doc__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 2px solid var(--gold); margin-bottom: 16px; }
.report-doc__head h2 { font-size: var(--fs-xl); color: var(--green-700); }
.report-doc__kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 20px; }
.report-kpi { background: var(--green-tint); border: 1px solid var(--green-soft); border-radius: var(--r-md); padding: 12px 8px; text-align: center; }
.report-kpi b { display: block; font-size: 1.5rem; font-weight: 900; color: var(--green-700); }
.report-kpi span { font-size: var(--fs-xs); color: var(--ink-soft); }
.report-doc__h3 { font-size: var(--fs-lg); margin: 18px 0 10px; color: var(--green-700); }
.report-doc table.tbl { min-width: 0; margin-bottom: 6px; }
@media (max-width: 600px) {
  .report-doc__kpis { grid-template-columns: repeat(2, 1fr); }
}

/* ============ OFFLINE BANNER ============ */
.net-banner {
  position: fixed; inset-block-start: 0; inset-inline: 0; z-index: 600;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  background: var(--warn); color: #fff;
  padding: 8px 14px; font-size: var(--fs-sm); font-weight: 600;
  box-shadow: var(--sh-md);
}
.net-banner svg { flex-shrink: 0; }

/* ============ INSTALL INVITE (auto-surfacing PWA banner) ============ */
.install-invite {
  position: fixed; inset-block-end: 0; inset-inline: 0; z-index: 700;
  margin: 0 auto; max-width: 460px;
  background: #fff; color: var(--ink);
  border: 1px solid var(--gold-soft);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--sh-lg);
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateY(120%);
  transition: transform .28s cubic-bezier(.22, 1, .36, 1);
}
.install-invite--in { transform: translateY(0); }
.install-invite__row { display: flex; align-items: center; gap: 12px; }
.install-invite__logo {
  flex-shrink: 0; width: 46px; height: 46px;
  border-radius: 11px; box-shadow: var(--sh-sm);
}
.install-invite__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.install-invite__text b { font-size: var(--fs-md); color: var(--green-700); }
.install-invite__text span { font-size: var(--fs-sm); color: var(--ink-soft); line-height: 1.6; }
.install-invite__cta { width: 100%; justify-content: center; margin-top: 14px; }
.install-invite__hint {
  margin: 12px 0 0; font-size: var(--fs-sm); color: var(--ink-soft); line-height: 1.9;
  background: var(--gold-tint); border-radius: var(--r-md); padding: 10px 12px;
}
.install-invite__x {
  position: absolute; inset-block-start: 8px; inset-inline-start: 8px;
  display: inline-flex; padding: 6px; border: none; background: transparent;
  color: var(--ink-faint); cursor: pointer; border-radius: var(--r-sm);
}
.install-invite__x:hover { background: var(--green-tint); color: var(--ink); }
.install-invite__x svg { width: 18px; height: 18px; }

/* ============ SCHEDULE DRILL-DOWN (hierarchical) ============ */
.crumb { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; font-size: var(--fs-sm); }
.crumb a { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; color: var(--green); cursor: pointer; padding: 4px 6px; border-radius: var(--r-sm); }
.crumb a:hover { background: var(--green-tint); }
.crumb span:not(.crumb__sep) { font-weight: 700; color: var(--ink); padding: 4px 6px; }
.crumb a svg, .crumb span svg { width: 15px; height: 15px; }
.crumb__sep { color: var(--ink-faint); display: inline-flex; }
.crumb__sep svg { width: 14px; height: 14px; transform: scaleX(-1); }

.sc-summary__head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.sc-summary__head svg { width: 40px; height: 40px; color: var(--green); }
.sc-summary__head h2 { font-size: var(--fs-2xl); color: var(--green-700); }

.sc-list { display: flex; flex-direction: column; gap: 10px; }
.sc-card {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: start;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-sm); padding: 14px 16px; transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.sc-card:hover { transform: translateY(-1px); box-shadow: var(--sh-md); border-color: var(--green-soft); }
.sc-card__main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sc-card__main svg { width: 30px; height: 30px; color: var(--gold-600); flex-shrink: 0; }
.sc-card__main b { display: block; font-size: var(--fs-lg); color: var(--green-700); }
.sc-card__main .muted { font-size: var(--fs-sm); }
.sc-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-inline-start: auto; }
.sc-card__go { color: var(--ink-faint); display: inline-flex; flex-shrink: 0; }
.sc-card__go svg { width: 20px; height: 20px; transform: scaleX(-1); }

@media (max-width: 600px) {
  .sc-card { flex-wrap: wrap; }
  .sc-pills { width: 100%; margin-inline-start: 0; order: 3; }
  .sc-card__go { position: absolute; }
}

/* role-hidden helper */
[data-role-hidden] { display: none !important; }

/* ============ LOGIN ============ */
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}
.login__art {
  position: relative; overflow: hidden;
  background:
    radial-gradient(900px 500px at 75% 10%, rgba(201,162,39,0.16), transparent 60%),
    linear-gradient(160deg, #0c2f2b, #15514a 55%, #103e39);
  color: var(--cream);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 48px;
}
.login__art h2 { color: #fff; font-size: 2rem; line-height: 1.4; max-width: 22ch; }
.login__art p { color: #b6d2cb; margin-top: 14px; max-width: 34ch; }
.login__pattern { position: absolute; inset: 0; opacity: .07;
  background-image: radial-gradient(currentColor 1.4px, transparent 1.4px);
  background-size: 26px 26px; color: var(--gold); pointer-events: none; }
.login__panel { display: grid; place-items: center; padding: 32px; background: var(--cream); }
.login__box { width: min(380px, 100%); }
.login__box h1 { font-size: var(--fs-2xl); margin-bottom: 4px; }
.login__box .sub { color: var(--ink-soft); margin-bottom: 24px; font-size: var(--fs-sm); }
.demo-creds {
  margin-top: 18px; padding: 13px 15px; border: 1px dashed var(--line);
  border-radius: var(--r-md); background: var(--white); font-size: var(--fs-xs); color: var(--ink-soft);
}
.demo-creds b { color: var(--green-700); }
.demo-creds button { background:none;border:none;color:var(--tg);font-weight:700;text-decoration:underline; padding:0; font-size: var(--fs-xs); }

@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login__art { display: none; }
}

/* ============ RESPONSIVE SHELL ============ */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 300;
    width: 280px; transform: translateX(110%);
    transition: transform var(--t-mid); box-shadow: var(--sh-lg);
  }
  html[dir="rtl"] .sidebar { transform: translateX(110%); }
  .sidebar.open { transform: translateX(0) !important; }
  .burger { display: inline-flex; }
  .scrim { position: fixed; inset: 0; background: rgba(12,47,43,.4); z-index: 250; }
}

/* ============ MOBILE POLISH (phone-first — primary target) ============ */
@media (max-width: 600px) {
  .content { padding: 14px; }
  .topbar { padding: 0 14px; }
  .topbar h1 { font-size: var(--fs-lg); }
  .page-head h2 { font-size: var(--fs-xl); }
  .card, .card--pad-lg { padding: 15px; }
  .kpi__val { font-size: 2rem; }
  /* Calendar → compact dot mode (fits 7 columns, no horizontal scroll) */
  .cal-scroll-inner { min-width: 0; }
  .cal-grid { gap: 5px; }
  .cal-cell { min-height: 52px; padding: 5px 4px; }
  .cal-pill { display: none; }
  .cal-mini { display: flex; }
  .cal-dow { font-size: .62rem; }
  /* Comfortable touch targets */
  .btn--sm { padding: 8px 11px; }
  .btn--icon { padding: 9px; }
  table.tbl tbody td, table.tbl thead th { padding: 12px 12px; }
  .modal__body { padding: 18px; }
  .toast-root { inset-inline: 12px; max-width: none; }
}

/* ============ PRINT (PDF reports) ============ */
@media print {
  .sidebar, .topbar, .toolbar, .btn, .no-print { display: none !important; }
  .layout { grid-template-columns: 1fr; }
  body { background: #fff; }
  .content { max-width: 100%; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .print-only { display: block !important; }
}
.print-only { display: none; }

/* ===================== جدول الذهبية ٣ ===================== */
/* Segmented station switcher */
.seg {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--green-tint); border-radius: var(--r-md);
}
.seg__btn {
  border: none; background: transparent; cursor: pointer;
  padding: 7px 16px; border-radius: calc(var(--r-md) - 4px);
  font-family: inherit; font-weight: 800; font-size: var(--fs-sm);
  color: var(--ink-soft); transition: background .15s, color .15s;
}
.seg__btn:hover { color: var(--green-700); }
.seg__btn--on { background: #fff; color: var(--green-700); box-shadow: var(--sh-sm); }

.dh3-banner { text-align: center; padding: 4px 0 12px; }
.dh3-banner__unit {
  display: inline-block; background: var(--green); color: #fff;
  font-weight: 800; font-size: var(--fs-lg); padding: 4px 22px;
  border-radius: var(--r-pill); margin-bottom: 8px;
}
.dh3-banner h2 { color: var(--green-700); margin: 2px 0; }
.dh3-banner__sub { color: var(--ink-soft); font-weight: 700; }
.dh3-legend {
  display: flex; gap: 22px; justify-content: center; flex-wrap: wrap;
  margin-top: 6px; color: var(--ink-soft); font-size: var(--fs-sm); font-weight: 600;
}
.dh3-legend span { display: inline-flex; align-items: center; gap: 7px; }
.dh3-dot { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.dh3-dot--done { background: var(--late); }
.dh3-dot--soon { background: var(--ok); }

.dh3-tbl th, .dh3-tbl td { text-align: center; white-space: nowrap; }
.dh3-tbl td.tag-mono { font-weight: 800; }
.dh3-cell { font-weight: 700; }
.dh3-cell--done { background: var(--late-bg); color: var(--late); }
.dh3-cell--soon { background: var(--ok-bg);   color: var(--ok); }
.dh3-cell--empty { color: var(--ink-faint); }
.dh3-note { white-space: normal; min-width: 180px; color: var(--ink-soft); font-size: var(--fs-sm); text-align: start; }
