/* =========================================================
   Hodowle — motyw w odcieniach zieleni
   ========================================================= */
:root {
  --g-950: #0b231a;
  --g-900: #0f2e22;
  --g-800: #16402f;
  --g-700: #1e5a40;
  --g-600: #2a7350;
  --g-500: #3a8f63;
  --g-400: #5fae80;
  --g-300: #93cba6;
  --g-200: #c6e5cf;
  --g-100: #e4f3e8;
  --g-50:  #f3faf5;
  --sage:  #a9bfa8;
  --lime:  #b7d36b;

  --bg: #f3f7f2;
  --surface: #ffffff;
  --text: #1b2a22;
  --muted: #5d6f64;
  --line: #dbe8de;
  --red: #b83a2e;   --red-bg: #fbe9e6;
  --amber: #a46a09; --amber-bg: #fdf1d8;
  --blue: #2c6a8a;  --blue-bg: #e2f0f7;
  --pink: #a3456e;  --pink-bg: #f9e6ee;
  --teal: #1f7a75;  --teal-bg: #dff2ef;
  --gray: #66756c;  --gray-bg: #eef2ef;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(15, 46, 34, .06), 0 4px 18px rgba(15, 46, 34, .05);
  --shadow-lg: 0 10px 40px rgba(15, 46, 34, .14);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.5; }
a { color: var(--g-600); text-decoration: none; }
a:hover { color: var(--g-800); }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; color: var(--g-900); }
h1 { font-size: 1.65rem; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 1.3rem; font-weight: 800; }
h3 { font-size: 1.02rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
h3 .ico { color: var(--g-500); }
h4 { font-size: .95rem; margin-top: 1.2em; }
code { background: var(--g-100); padding: 1px 6px; border-radius: 5px; }
.muted { color: var(--muted); }
small { font-size: .82em; }
.hp { position: absolute; left: -9999px; }

.ico { width: 18px; height: 18px; stroke-width: 2; vertical-align: -3px; flex-shrink: 0; }
.ico-lg { width: 30px; height: 30px; }
.ico-xl { width: 48px; height: 48px; stroke-width: 1.5; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 262px; flex-shrink: 0; background: linear-gradient(180deg, var(--g-900), var(--g-950));
  color: #d6eadb; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { padding: 20px 18px 14px; }
.brand a { display: flex; align-items: center; gap: 12px; color: #fff; font-weight: 800; font-size: 1.15rem; }
.brand small { display: block; font-weight: 500; font-size: .72rem; color: var(--g-300); letter-spacing: .04em; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--g-500); display: grid; place-items: center; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.brand-mark .ico { width: 22px; height: 22px; color: #fff; }
.sidebar nav { padding: 6px 10px 20px; flex: 1; }
.nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--g-400); padding: 16px 10px 6px; font-weight: 700; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: #cfe3d5; font-weight: 500; font-size: .93rem; margin-bottom: 2px; transition: background .15s, color .15s; }
.nav-link:hover { background: rgba(147, 203, 166, .1); color: #fff; }
.nav-link.active { background: var(--g-600); color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.nav-link .ico { color: var(--g-300); }
.nav-link.active .ico { color: #fff; }
.nav-add { margin-top: 10px; border: 1px dashed rgba(147, 203, 166, .35); }
.kennel-switch { padding: 0 4px 8px; }
.kennel-switch select { width: 100%; background: rgba(255,255,255,.07); color: #fff; border: 1px solid rgba(147,203,166,.25); border-radius: 10px; padding: 9px 10px; font: inherit; font-size: .9rem; }
.kennel-switch option { color: var(--text); }
.sidebar-foot { padding: 12px 20px; font-size: .72rem; color: var(--g-400); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 62px; background: rgba(255,255,255,.85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 26px; position: sticky; top: 0; z-index: 20; }
.topbar-title { flex: 1; }
.kennel-logo { display: inline-flex; align-items: center; height: 46px; max-width: min(320px, 55vw); }
.kennel-logo img { max-height: 46px; max-width: 100%; width: auto; object-fit: contain; display: block; }
.logo-preview { min-height: 70px; display: flex; align-items: center; justify-content: center; padding: 12px; background: repeating-conic-gradient(#f3f7f2 0 25%, #fff 0 50%) 50% / 16px 16px; border: 1px solid var(--line); border-radius: 12px; }
.logo-preview img { max-width: 100%; max-height: 120px; object-fit: contain; }
.kc-logo { height: 44px; display: flex; align-items: center; margin-bottom: 6px; }
.kc-logo img { max-height: 44px; max-width: 200px; object-fit: contain; }
.kennel-chip { display: inline-flex; align-items: center; gap: 7px; background: var(--g-100); color: var(--g-800); font-weight: 700; padding: 5px 12px; border-radius: 99px; font-size: .88rem; }
.menu-btn { display: none; background: none; border: 0; cursor: pointer; color: var(--g-800); padding: 6px; }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; background: none; border: 0; cursor: pointer; font: inherit; color: var(--text); padding: 5px 8px; border-radius: 10px; }
.user-btn:hover { background: var(--g-50); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--g-500), var(--g-700)); color: #fff; display: grid; place-items: center; font-weight: 800; }
.user-info { text-align: left; line-height: 1.2; }
.avatar { overflow: hidden; flex-shrink: 0; }
.avatar.has-img { background: var(--g-100); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-sm { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--g-500), var(--g-700)); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .9rem; }
.avatar-xl { width: 96px !important; height: 96px !important; font-size: 2.2rem; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--g-500), var(--g-700)); color: #fff; font-weight: 800; box-shadow: 0 0 0 4px var(--g-100); }
.person { display: flex; align-items: center; gap: 10px; text-align: left; }
.profile-avatar { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.profile-avatar h3 { margin-bottom: 2px; }
.avatar-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.avatar-pick { cursor: pointer; }
.avatar-pick.loading { opacity: .6; pointer-events: none; }
.hero-photo-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hero-photo-wrap .avatar-form { justify-content: center; margin-top: 6px; }
.user-info small { display: block; color: var(--muted); }
.dropdown { display: none; position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 200px; padding: 6px; z-index: 30; }
.dropdown.open { display: block; }
.dropdown a, .dropdown button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 12px; border-radius: 8px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.dropdown a:hover, .dropdown button:hover { background: var(--g-50); }

.content { padding: 26px 30px 60px; max-width: 1480px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.subtitle { margin: 4px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { display: flex; gap: 8px; font-size: .85rem; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }

/* ---------- Cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .grid-2, .grid-2 + .card, .kpi-row + .grid-2 { margin-top: 18px; }
.grid-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-2-1 > .card, .grid-2-1 .stack > .card { margin-bottom: 0; }
.grid-2-1 + * { margin-top: 18px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack > .card { margin-bottom: 0; }

.kpi-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); color: var(--text); transition: transform .15s, box-shadow .15s; }
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: var(--text); }
.kpi-ico { width: 46px; height: 46px; border-radius: 13px; background: var(--g-100); color: var(--g-600); display: grid; place-items: center; flex-shrink: 0; }
.kpi-ico .ico { width: 22px; height: 22px; }
.kpi-val { display: block; font-size: 1.45rem; font-weight: 800; color: var(--g-900); line-height: 1.1; }
.kpi-label { display: block; font-size: .82rem; color: var(--muted); font-weight: 600; }
.kpi small { color: var(--amber); font-weight: 600; }

.welcome { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; background: linear-gradient(120deg, var(--g-700), var(--g-500)); color: #fff; border: 0; }
.welcome h3, .welcome h3 .ico { color: #fff; }
.welcome p { margin: 0; color: var(--g-100); }
.welcome-steps { display: flex; gap: 8px; flex-wrap: wrap; }
.welcome .btn-outline { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.4); }
.welcome .btn-primary { background: #fff; color: var(--g-800); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 17px; border-radius: 10px; font: inherit; font-weight: 700; font-size: .92rem; cursor: pointer; border: 1px solid transparent; transition: background .15s, border-color .15s, transform .05s; text-decoration: none; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--g-600); color: #fff; }
.btn-primary:hover { background: var(--g-700); color: #fff; }
.btn-outline { background: #fff; color: var(--g-700); border-color: var(--g-300); }
.btn-outline:hover { background: var(--g-50); border-color: var(--g-500); color: var(--g-800); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--g-50); color: var(--g-800); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #962c22; color: #fff; }
.btn-sm { padding: 7px 12px; font-size: .84rem; }
.btn-block { width: 100%; }
.icon-btn { display: inline-flex; align-items: center; gap: 5px; justify-content: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 9px; border: 0; background: transparent; color: var(--g-600); cursor: pointer; font: inherit; font-size: .85rem; font-weight: 600; }
.icon-btn:hover { background: var(--g-100); color: var(--g-800); }
.icon-btn.danger { color: var(--red); }
.icon-btn.danger:hover { background: var(--red-bg); }
.page-actions .icon-btn.danger { border: 1px solid #ecc6c0; height: 40px; padding: 0 14px; background: #fff; }
.link-btn { background: none; border: 0; color: var(--g-600); cursor: pointer; font: inherit; font-size: .82rem; padding: 0; }
.link { font-weight: 600; font-size: .88rem; }
form.inline { display: inline; margin: 0; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: .84rem; font-weight: 700; color: var(--g-900); }
.req { color: var(--red); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=tel], input:not([type]), select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #cfdfd3; border-radius: var(--radius-sm); font: inherit; font-size: .93rem; color: var(--text); background: #fff; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--g-500); box-shadow: 0 0 0 3px rgba(58, 143, 99, .16); }
input:disabled, select:disabled { background: var(--g-50); color: var(--muted); }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--g-600); vertical-align: -3px; }
input[type=file] { padding: 9px; border: 1px dashed var(--g-300); border-radius: var(--radius-sm); background: var(--g-50); width: 100%; font: inherit; font-size: .88rem; }
.tags-input { border: 1px solid #cfdfd3; border-radius: var(--radius-sm); padding: 8px; background: #fff; display: flex; flex-direction: column; gap: 8px; }
.tags-input:focus-within { border-color: var(--g-500); box-shadow: 0 0 0 3px rgba(58, 143, 99, .16); }
.tags-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tags-chips[hidden] { display: none; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--g-100); color: var(--g-800); font-weight: 700; font-size: .84rem; padding: 4px 4px 4px 11px; border-radius: 99px; }
.tag-chip button { border: 0; background: transparent; color: var(--g-700); width: 22px; height: 22px; border-radius: 50%; cursor: pointer; font-size: 1rem; line-height: 1; }
.tag-chip button:hover { background: var(--g-200); }
.tags-row { display: flex; gap: 8px; }
.tags-row input { border: 0 !important; box-shadow: none !important; padding: 6px 4px !important; flex: 1; min-width: 0; }
.tag-list { display: inline-flex; flex-wrap: wrap; gap: 5px; }
.date-range { display: flex; align-items: center; gap: 8px; }
.date-range input { flex: 1; min-width: 0; }
.date-range span { color: var(--muted); font-weight: 700; }
.nowrap { white-space: nowrap; }
.select-sm { padding: 5px 8px !important; font-size: .84rem !important; width: auto !important; }
.hint { color: var(--muted); font-size: .8rem; }
.error { color: var(--red); font-weight: 600; font-size: .8rem; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--red); }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500 !important; cursor: pointer; }
.field-check { justify-content: flex-end; padding-bottom: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-section { border: 0; padding: 0; margin: 0 0 22px; }
.form-section legend { font-weight: 800; color: var(--g-700); font-size: .8rem; text-transform: uppercase; letter-spacing: .09em; padding: 0 0 10px; width: 100%; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 6px; }
.form-card { max-width: 1100px; }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; padding: 14px 18px; }
.filters .field { flex: 1 1 200px; max-width: 360px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { max-width: 280px; }
.choice-row { display: flex; gap: 10px; flex-wrap: wrap; }
.choice input { display: none; }
.choice span { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border: 1.5px solid var(--g-200); border-radius: 11px; cursor: pointer; font-weight: 700; color: var(--g-800); background: #fff; transition: all .15s; }
.choice input:checked + span { background: var(--g-600); border-color: var(--g-600); color: #fff; }
.choice input:checked + span .ico { color: #fff; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 42px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; }
.strength { height: 5px; border-radius: 3px; background: var(--g-100); overflow: hidden; margin-top: 2px; }
.strength span { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--g-700); font-weight: 800; padding: 10px 10px; border-bottom: 2px solid var(--g-100); white-space: nowrap; }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: var(--g-50); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.table .num { text-align: right; font-weight: 700; white-space: nowrap; }
.table.compact td { padding: 7px 8px; }
.row-muted { background: var(--g-50); }
.perm-table td:not(:first-child), .perm-table th:not(:first-child) { text-align: center; }
.weights-table td, .weights-table th { text-align: center; white-space: nowrap; }
.bar-cell { width: 40%; }
.bar { display: block; height: 8px; border-radius: 4px; min-width: 3px; }
.bar.pos { background: var(--g-400); }
.bar.neg { background: #e0a49c; }
.pos { color: var(--g-600); font-weight: 700; }
.neg { color: var(--red); font-weight: 700; }

/* ---------- Badges, alerts ---------- */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; font-size: .74rem; font-weight: 700; white-space: nowrap; line-height: 1.6; }
.badge-green { background: var(--g-100); color: var(--g-700); }
.badge-lime { background: #eef6d6; color: #5a7012; }
.badge-teal { background: var(--teal-bg); color: var(--teal); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-pink { background: var(--pink-bg); color: var(--pink); }
.badge-gray { background: var(--gray-bg); color: var(--gray); }
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 11px; margin-bottom: 14px; font-size: .92rem; border: 1px solid; }
.alert span { flex: 1; }
.alert-success { background: var(--g-100); color: var(--g-800); border-color: var(--g-200); }
.alert-error { background: var(--red-bg); color: #8b2a20; border-color: #f0c9c3; }
.alert-info { background: var(--blue-bg); color: #1f4f68; border-color: #c4e0ee; }
.alert-warning { background: var(--amber-bg); color: #7d520a; border-color: #f2dfae; }
.alert-close { background: none; border: 0; font-size: 1.3rem; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }

.empty-state { text-align: center; padding: 48px 24px; }
.empty-state .ico-xl { color: var(--g-400); margin-bottom: 8px; }
.empty-state p { color: var(--muted); }
.empty-inline { display: flex; align-items: center; gap: 9px; color: var(--muted); padding: 14px; background: var(--g-50); border-radius: 10px; font-size: .9rem; }

/* ---------- Details ---------- */
.details { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 20px; margin: 0 0 20px; }
.details.one { grid-template-columns: 1fr; }
.details .wide { grid-column: 1 / -1; }
.details dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.details dd { margin: 2px 0 0; font-weight: 600; word-break: break-word; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 7px 0; border-bottom: 1px solid var(--line); }

/* ---------- Tabs ---------- */
.tabs-bar { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; font-size: .9rem; }
.tab:hover { color: var(--g-700); }
.tab.active { color: var(--g-700); border-color: var(--g-500); }
.tab .count { background: var(--g-100); color: var(--g-700); border-radius: 99px; padding: 0 7px; font-size: .74rem; }

/* ---------- Events ---------- */
.event-list { list-style: none; margin: 0; padding: 0; }
.ev { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); }
.ev:last-child { border-bottom: 0; }
.ev a { color: var(--text); flex: 1; min-width: 0; }
.ev a strong { display: block; font-weight: 600; font-size: .9rem; }
.ev a small { color: var(--muted); }
.ev-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.ev-ico .ico { width: 17px; height: 17px; }
.ev-green .ev-ico, .cal-ev.ev-green { background: var(--g-100); color: var(--g-700); }
.ev-amber .ev-ico, .cal-ev.ev-amber { background: var(--amber-bg); color: var(--amber); }
.ev-red .ev-ico, .cal-ev.ev-red { background: var(--red-bg); color: var(--red); }
.ev-blue .ev-ico, .cal-ev.ev-blue { background: var(--blue-bg); color: var(--blue); }
.ev-pink .ev-ico, .cal-ev.ev-pink { background: var(--pink-bg); color: var(--pink); }
.ev-rose .ev-ico, .cal-ev.ev-rose { background: #fbecec; color: #b04a4a; }
.ev-teal .ev-ico, .cal-ev.ev-teal { background: var(--teal-bg); color: var(--teal); }
.ev-gray .ev-ico, .cal-ev.ev-gray { background: var(--gray-bg); color: var(--gray); }

/* ---------- Calendar ---------- */
.grid-cal { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.grid-cal > .card { margin-bottom: 0; }
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.cal-head h3 { margin: 0 8px; min-width: 170px; text-align: center; justify-content: center; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { text-align: center; font-size: .74rem; font-weight: 800; color: var(--g-700); text-transform: uppercase; padding: 4px 0; }
.cal-day { min-height: 98px; border: 1px solid var(--line); border-radius: 10px; padding: 5px; background: #fff; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-day.out { background: transparent; border-color: transparent; }
.cal-day.today { border-color: var(--g-500); box-shadow: inset 0 0 0 1px var(--g-500); background: var(--g-50); }
.cal-num { font-size: .8rem; font-weight: 800; color: var(--g-800); }
.cal-ev { display: block; font-size: .7rem; font-weight: 600; padding: 2px 5px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-more { font-size: .68rem; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; font-size: .78rem; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend .ev-green::before { background: var(--g-400); } .legend .ev-amber::before { background: #e3b04b; } .legend .ev-red::before { background: var(--red); }
.legend .ev-blue::before { background: var(--blue); } .legend .ev-pink::before { background: var(--pink); } .legend .ev-rose::before { background: #d07878; } .legend .ev-teal::before { background: var(--teal); }

/* ---------- Animals ---------- */
.animal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.animal-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--text); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; display: flex; flex-direction: column; }
.animal-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); color: var(--text); }
.animal-photo { height: 170px; display: grid; place-items: center; position: relative; background: linear-gradient(135deg, var(--g-100), var(--g-200)); color: var(--g-500); }
.animal-photo.f { background: linear-gradient(135deg, #eef5e6, #d9ecd2); }
.animal-photo img { width: 100%; height: 100%; object-fit: cover; }
.sex-tag { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.92); display: grid; place-items: center; font-weight: 800; color: var(--g-700); }
.animal-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.animal-body strong { font-size: 1rem; color: var(--g-900); }
.animal-body .call { color: var(--g-600); font-weight: 600; font-size: .9rem; }
.animal-body small { color: var(--muted); }
.animal-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; font-size: .8rem; color: var(--muted); }
.animal-due { margin-top: 6px; font-size: .8rem; }
.animal-hero { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.hero-photo { width: 150px; height: 150px; border-radius: 18px; overflow: hidden; background: linear-gradient(135deg, var(--g-100), var(--g-200)); display: grid; place-items: center; color: var(--g-500); flex-shrink: 0; }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }
.hero-info { flex: 1; min-width: 240px; }
.hero-info h2 { margin: 6px 0 0; font-size: 1.5rem; }
.hero-info .call { margin: 0; color: var(--g-600); font-weight: 700; font-size: 1.05rem; }
.hero-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 12px; color: var(--muted); font-size: .9rem; }
.hero-facts .ico { color: var(--g-500); }

.pedigree { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; align-items: center; }
.ped-col { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.ped { display: block; background: var(--g-50); border: 1px solid var(--g-200); border-left: 4px solid var(--g-500); border-radius: 9px; padding: 8px 10px; color: var(--text); font-size: .82rem; }
.ped strong { display: block; font-weight: 700; }
.ped small { color: var(--muted); }
a.ped:hover { background: var(--g-100); }
.ped.empty { opacity: .55; border-left-color: var(--g-200); }
.ped-col:nth-child(3) .ped { padding: 6px 8px; font-size: .76rem; }

/* ---------- Litters ---------- */
.litter-grid, .kennel-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.litter-card { display: flex; gap: 16px; color: var(--text); margin: 0; transition: transform .15s; }
.litter-card:hover { transform: translateY(-2px); color: var(--text); }
.litter-letter { width: 58px; height: 58px; border-radius: 16px; background: linear-gradient(135deg, var(--g-500), var(--g-700)); color: #fff; font-size: 1.7rem; font-weight: 800; display: grid; place-items: center; flex-shrink: 0; }
.litter-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.litter-body small { color: var(--muted); }
.litter-body .parents { color: var(--g-700); font-weight: 600; }
.litter-stats { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: .82rem; margin-top: 4px; }
.weigh-form { margin-top: 18px; padding: 16px; background: var(--g-50); border-radius: 12px; }
.weigh-form h4 { margin-top: 0; }
.kennel-card { display: flex; flex-direction: column; gap: 4px; color: var(--text); margin: 0; }
.kennel-card:hover { color: var(--text); box-shadow: var(--shadow-lg); }
.kc-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--g-100); color: var(--g-600); display: grid; place-items: center; margin-bottom: 6px; }

/* ---------- Documents ---------- */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.doc-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; background: #fff; }
.doc-thumb { height: 110px; background: var(--g-50); display: grid; place-items: center; color: var(--g-500); position: relative; }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-thumb .ext { position: absolute; bottom: 8px; right: 8px; font-size: .68rem; font-weight: 800; background: var(--g-600); color: #fff; padding: 1px 6px; border-radius: 5px; }
.doc-meta { padding: 8px 10px 0; display: flex; flex-direction: column; min-width: 0; }
.doc-meta strong { font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-meta small { color: var(--muted); font-size: .72rem; }
.doc-actions { display: flex; justify-content: flex-end; padding: 2px 4px 4px; }
.doc-thumb { cursor: zoom-in; }
.upload-box { border: 1.5px dashed var(--g-300); border-radius: 12px; padding: 14px; background: var(--g-50); display: flex; flex-direction: column; gap: 12px; }

/* ---------- Podgląd dokumentów ---------- */
body.viewer-open { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 100; background: rgba(11, 35, 26, .92); display: flex; flex-direction: column; }
.viewer[hidden] { display: none; }
.viewer-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; color: #fff; background: rgba(11, 35, 26, .6); border-bottom: 1px solid rgba(147, 203, 166, .2); }
.viewer-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.viewer-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-title small { color: var(--g-300); }
.viewer-count { color: var(--g-300); font-size: .85rem; font-weight: 700; padding: 0 6px; }
.viewer-btn { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.1); color: #fff; border: 0; font-size: 1.15rem; cursor: pointer; text-decoration: none; }
.viewer-btn:hover { background: var(--g-600); color: #fff; }
.viewer-btn[hidden] { display: none; }
.viewer-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 18px 70px; overflow: auto; }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.4); background: #fff; cursor: zoom-in; }
.viewer-stage.zoom { align-items: flex-start; justify-content: flex-start; }
.viewer-stage.zoom img { max-width: none; max-height: none; cursor: zoom-out; }
.viewer-stage iframe { width: 100%; max-width: 1100px; height: 100%; border: 0; border-radius: 8px; background: #fff; }
.viewer-none { background: #fff; border-radius: 14px; padding: 30px; text-align: center; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; border: 0; border-radius: 12px; background: rgba(255,255,255,.12); color: #fff; font-size: 2.2rem; line-height: 1; cursor: pointer; z-index: 2; }
.viewer-nav:hover { background: var(--g-600); }
.viewer-nav.prev { left: 12px; }
.viewer-nav.next { right: 12px; }
.viewer-nav[hidden] { display: none; }
@media (max-width: 640px) {
  .viewer-stage { padding: 10px; }
  .viewer-nav { top: auto; bottom: 14px; transform: none; width: 52px; height: 52px; }
}

/* PDF renderowany przez PDF.js (telefony, tablety) */
.viewer-stage.pdf-mode { align-items: center; justify-content: center; padding: 12px 10px 84px; -webkit-overflow-scrolling: touch; touch-action: pan-y pinch-zoom; }
.viewer-stage.pdf-mode.pdf-zoomed { align-items: flex-start; justify-content: flex-start; touch-action: auto; }
.viewer-stage.pdf-zoomed .pdf-page-box { margin: auto; }
.pdf-pages { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 0 auto; }
.pdf-page-box { position: relative; background: #fff; border-radius: 4px; box-shadow: 0 6px 24px rgba(0,0,0,.35); flex-shrink: 0; }
.pdf-page-box canvas { display: block; border-radius: 4px; }
.pdf-num { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: var(--g-300); font-weight: 800; font-size: 1.4rem; }
.pdf-page-box canvas + .pdf-num, .pdf-page-box .pdf-num:not(:only-child) { display: none; }
.pdf-loading { color: #fff; display: flex; align-items: center; gap: 10px; margin-top: 30vh; font-weight: 600; }
.spinner { width: 22px; height: 22px; border: 3px solid rgba(255,255,255,.25); border-top-color: var(--g-300); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pdf-tools { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 3; display: flex; align-items: center; gap: 4px; background: rgba(15, 46, 34, .95); border: 1px solid rgba(147, 203, 166, .3); border-radius: 99px; padding: 5px 8px; box-shadow: 0 8px 30px rgba(0,0,0,.35); color: #fff; }
.pdf-tools button { width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: #fff; font-size: 1.05rem; font-weight: 700; cursor: pointer; }
.pdf-tools button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.pdf-tools button:active, .pdf-tools button:hover { background: var(--g-600); }
.pdf-tools button:disabled { opacity: .3; background: transparent; cursor: default; }
.pdf-page { font-size: .88rem; padding: 0 6px; white-space: nowrap; color: var(--g-200); }
.pdf-page b { color: #fff; }
.pdf-sep { width: 1px; height: 22px; background: rgba(147, 203, 166, .3); margin: 0 4px; }
.viewer-none-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
@media (max-width: 640px) {
  .viewer-nav { bottom: 78px; z-index: 4; background: rgba(15, 46, 34, .92); border: 1px solid rgba(147, 203, 166, .3); width: 46px; height: 46px; font-size: 1.8rem; }
}

/* ---------- Pregnancy ---------- */
.preg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.preg-card { border: 1px solid var(--g-200); border-radius: 12px; padding: 14px; background: var(--g-50); }
.preg { margin-bottom: 12px; }
.preg-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; font-size: .9rem; }
.progress { height: 10px; background: var(--g-100); border-radius: 99px; overflow: hidden; margin-bottom: 6px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--g-400), var(--g-600)); border-radius: 99px; }
.milestones { list-style: none; padding: 0; margin: 12px 0 0; font-size: .84rem; }
.milestones li { padding: 6px 0 6px 22px; position: relative; border-bottom: 1px dashed var(--g-200); }
.milestones li::before { content: ""; position: absolute; left: 2px; top: 11px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--g-300); background: #fff; }
.milestones li.done::before { background: var(--g-500); border-color: var(--g-500); }
.milestones li.done { color: var(--muted); }
.milestones span { display: block; font-size: .74rem; color: var(--g-600); font-weight: 700; }
.preg-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; margin-bottom: 14px; }

.danger-zone { margin-top: 24px; border: 1px solid #f0c9c3; border-radius: var(--radius); padding: 14px 18px; background: #fff; }
.danger-zone summary { cursor: pointer; font-weight: 700; color: var(--red); display: flex; align-items: center; gap: 8px; }
.danger-zone p { color: var(--muted); }
form.danger-zone { display: flex; justify-content: flex-end; border: 0; background: none; padding: 0; }

/* ---------- Auth ---------- */
body.auth { background: var(--g-50); }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.auth-side { background: radial-gradient(circle at 20% 20%, var(--g-600), var(--g-900) 70%); color: #e6f4ea; padding: 60px 56px; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.auth-side::after { content: "🐾"; position: absolute; font-size: 260px; right: -40px; bottom: -60px; opacity: .07; transform: rotate(-18deg); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.4rem; margin-bottom: 40px; color: #fff; }
.auth-brand .ico { width: 32px; height: 32px; color: var(--g-300); }
.auth-side h2 { color: #fff; font-size: 2rem; max-width: 420px; }
.auth-points { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-direction: column; gap: 14px; max-width: 440px; }
.auth-points li { display: flex; gap: 12px; align-items: flex-start; color: var(--g-100); }
.auth-points .ico { color: var(--g-300); margin-top: 2px; }
.auth-card { align-self: center; justify-self: center; width: 100%; max-width: 440px; padding: 40px 32px; }
.auth-card.wide { max-width: 640px; }
.auth-card .stack { gap: 16px; }
.auth-links { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; font-size: .9rem; text-align: center; }

.backdrop { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-cal { grid-template-columns: 1fr; }
  .grid-2-1 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(11, 35, 26, .45); z-index: 40; }
  .menu-btn { display: block; }
  .grid-2 { grid-template-columns: 1fr; }
  .content { padding: 18px 16px 50px; }
  .topbar { padding: 0 16px; }
  .user-info { display: none; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { padding: 32px 24px; }
  .auth-side h2 { font-size: 1.4rem; }
  .auth-points { display: none; }
  .auth-brand { margin-bottom: 14px; }
  .auth-card { padding: 28px 18px; }
  .cal-day { min-height: 64px; }
  .cal-ev { font-size: 0; height: 6px; padding: 0; }
  .pedigree { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  h1 { font-size: 1.35rem; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 6px 10px; background: #fff; }
  .table td { border: 0; padding: 5px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table td[data-label]::before { content: attr(data-label); font-weight: 700; color: var(--muted); font-size: .78rem; text-align: left; }
  .table .actions { width: 100%; justify-content: flex-end; }
  .table.compact tr, .weights-table tr { display: table-row; border: 0; }
  .table.compact, .weights-table { display: table; }
  .table.compact tbody, .weights-table tbody { display: table-row-group; }
  .table.compact td, .weights-table td { display: table-cell; text-align: left; }
  .weights-table thead { display: table-header-group; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .kpi { padding: 12px; gap: 10px; }
  .kpi-ico { width: 38px; height: 38px; }
  .kpi-val { font-size: 1.15rem; }
}
