/* Crinas demo app */

@font-face { font-family: "Gloock"; font-weight: 400; font-display: swap; src: url("../assets/fonts/gloock-400.woff2") format("woff2"); }
@font-face { font-family: "Onest"; font-weight: 400 600; font-display: swap; src: url("../assets/fonts/onest-var.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("../assets/fonts/plexmono-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("../assets/fonts/plexmono-500.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --stone: #E8E9E2;
  --paper: #F6F6F1;
  --white: #FFFFFF;
  --ink: #1B1E19;
  --muted: #4E5349;
  --muted-2: #5A5F55;
  --line: #CFD1C6;
  --line-soft: #E1E2DA;
  --sage: #E3E6DC;
  --chestnut: #8B4A1F;
  --chestnut-dark: #6A3614;
  --chestnut-soft: #F2DFD0;
  --chestnut-light: #C18A5B;
  --green: #22382C;
  --green-2: #2C4638;
  --green-line: #3A5244;
  --straw: #D9B75E;
  --straw-soft: #F3E7C4;
  --on-green: #EEF0E8;
  --on-green-muted: #AEB7A7;
  --ok: #2F5E43;
  --ok-soft: #DCE8DF;

  --display: "Gloock", Georgia, serif;
  --sans: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--stone); color: var(--ink); font: 400 15px/1.5 var(--sans); -webkit-text-size-adjust: 100%; }
h1, h2, h3 { margin: 0; font-weight: 400; text-wrap: balance; }
p { margin: 0; }
a { color: var(--chestnut); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--straw); outline-offset: 2px; border-radius: 6px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted-2); }
.num { font-variant-numeric: tabular-nums; }

/* Shell */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100%; }
@media (min-width: 901px) { .app { background: linear-gradient(to right, var(--green) 240px, var(--stone) 240px); } }
.side { position: sticky; top: 0; height: 100vh; background: var(--green); color: var(--on-green); display: flex; flex-direction: column; gap: 24px; padding: 22px 14px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: var(--on-green); text-decoration: none; }
.brand b { font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1; }
.yard { padding: 12px; border-radius: 12px; background: var(--green-2); font-size: 13px; }
.yard strong { display: block; font-size: 15px; font-weight: 600; }
.yard span { color: var(--on-green-muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--on-green-muted); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--on-green); background: rgba(255, 255, 255, 0.05); }
.nav a.on { color: var(--white); background: rgba(255, 255, 255, 0.1); }
.nav a.on svg { color: var(--straw); }
.nav .count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--chestnut); color: var(--white); font-size: 12px; text-align: center; }
.side-foot { margin-top: auto; font-size: 12px; color: var(--on-green-muted); padding: 0 8px; }
.side-foot a { color: var(--on-green); }

.main { min-width: 0; padding: 24px clamp(16px, 3vw, 40px) 64px; }
.demo-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 22px; padding: 10px 14px; border-radius: 12px; background: var(--straw-soft); color: #5B4712; font-size: 13px; }
.demo-bar a { color: #5B4712; font-weight: 600; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 22px; }
.page-head h1 { font-family: var(--display); font-size: clamp(30px, 3.4vw, 40px); line-height: 1.05; }
.page-head .sub { color: var(--muted-2); margin-top: 4px; }
.crumb { font-size: 13px; margin-bottom: 6px; }
.crumb a { color: var(--muted-2); text-decoration: none; }
.crumb a:hover { color: var(--chestnut); }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: sticky; top: 0; z-index: 5; height: auto; flex-direction: column; gap: 10px; padding: 12px 12px 8px; }
  .side .yard, .side-foot { display: none; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; padding: 8px 12px; font-size: 14px; }
  .nav .count { margin-left: 2px; }
}

/* Building blocks */
.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .g-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-2 { grid-template-columns: minmax(0, 1fr); } }

.card { background: var(--paper); border: 1px solid var(--line-soft); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card.white { background: var(--white); }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; }
.card-head h2 { font-family: var(--display); font-size: 22px; }
.card-head .meta { font-size: 13px; color: var(--muted-2); }
.stack { display: flex; flex-direction: column; gap: 16px; }

.stat { background: var(--paper); border: 1px solid var(--line-soft); border-radius: 16px; padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; }
a.stat:hover { border-color: var(--line); }
.stat .label { font-size: 13px; color: var(--muted-2); }
.stat .value { font-family: var(--display); font-size: 40px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: 13px; color: var(--muted-2); }
.stat.warn .value { color: var(--chestnut); }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 12px; line-height: 1.35; white-space: nowrap; background: var(--sage); color: var(--green); }
.pill.warn { background: var(--chestnut-soft); color: var(--chestnut-dark); font-weight: 500; }
.pill.late { background: var(--chestnut); color: var(--white); font-weight: 500; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.straw { background: var(--straw-soft); color: #5B4712; }
.pill.plain { background: transparent; border: 1px solid var(--line); color: var(--muted-2); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); font-weight: 500; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.primary { background: var(--chestnut); border-color: var(--chestnut); color: var(--white); }
.btn.primary:hover { background: var(--chestnut-dark); border-color: var(--chestnut-dark); }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn.ghost { border-color: var(--line); }
.btn.ghost:hover { background: var(--sage); color: var(--ink); border-color: var(--line); }
.btn:disabled { opacity: .45; cursor: default; background: transparent; color: var(--ink); }

/* Lists and tables */
.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.row:first-child { border-top: 0; }
.row.two { grid-template-columns: minmax(0, 1fr) auto; }
.row .time { font-family: var(--mono); font-size: 13px; color: var(--muted-2); }
.row .time.due { color: var(--chestnut); }
.row strong { display: block; font-weight: 600; }
.row small { display: block; color: var(--muted-2); font-size: 13px; }
.row a { color: inherit; text-decoration: none; }
.row a:hover strong { color: var(--chestnut); }

.table-wrap { overflow-x: auto; margin-inline: -4px; padding-inline: 4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted-2); padding: 0 12px 10px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl a.name { color: var(--ink); font-weight: 600; text-decoration: none; }
.tbl a.name:hover { color: var(--chestnut); }
.tbl .sub { display: block; font-size: 12px; color: var(--muted-2); }
.tbl tbody tr.link { cursor: pointer; }
.tbl tbody tr.link:hover td { background: rgba(255, 255, 255, 0.5); }

.check { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); cursor: pointer; }
.check:first-child { border-top: 0; }
.check input { width: 20px; height: 20px; accent-color: var(--green); flex: none; }
.check.done span { color: var(--muted-2); text-decoration: line-through; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.search { flex: 1 1 240px; min-height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); font: inherit; }
.search:focus { outline: 2px solid var(--chestnut); outline-offset: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; font-size: 14px; }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* Farrier bars */
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.bar-row:first-child { border-top: 0; }
.bar-row .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bar-row .who input { width: 18px; height: 18px; accent-color: var(--chestnut); flex: none; }
.bar-row .who a { color: var(--ink); font-weight: 600; text-decoration: none; }
.bar-row .who a:hover { color: var(--chestnut); }
.bar-row .info { font-size: 13px; color: var(--muted-2); }
.bar { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: var(--line-soft); position: relative; }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--green); }
.bar i.soon { background: var(--chestnut-light); }
.bar i.late { background: var(--chestnut); }
.bar .tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .35; }

/* Facilities */
.boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.box { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 12px; background: var(--white); border: 1px solid var(--line-soft); color: var(--ink); text-decoration: none; min-height: 78px; }
a.box:hover { border-color: var(--chestnut); }
.box small { font-family: var(--mono); font-size: 12px; color: var(--muted-2); }
.box strong { font-weight: 600; }
.box em { font-style: normal; font-size: 12px; color: var(--muted-2); }
.box.free { background: transparent; border: 1.5px dashed #A5A89C; color: var(--ok); }
.paddocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.paddock { padding: 14px; border-radius: 12px; background: var(--sage); display: flex; flex-direction: column; gap: 6px; }
.paddock a { color: var(--ink); }

/* Horse record */
.horse-head { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.horse-photo { width: 88px; height: 88px; border-radius: 18px; flex: none; display: grid; place-items: center; color: var(--white); font-family: var(--display); font-size: 36px; }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); overflow-x: auto; margin-bottom: 18px; }
.tabs button { background: none; border: 0; padding: 0 0 12px; color: var(--muted-2); cursor: pointer; white-space: nowrap; font-weight: 500; border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--chestnut); }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px 24px; }
.fields small { display: block; font-size: 12px; color: var(--muted-2); }
.fields a { text-decoration: none; }
.timeline { display: flex; flex-direction: column; }
.timeline > div { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 14px; padding: 11px 0; border-top: 1px solid var(--line-soft); font-size: 14px; }
.timeline > div:first-child { border-top: 0; }
.timeline .mono { color: var(--muted-2); font-size: 13px; }
.timeline .future .mono, .timeline .future span { color: var(--muted-2); }
.timeline .today .mono { color: var(--chestnut); font-weight: 500; }
.note-form { display: flex; gap: 8px; }
.note-form input { flex: 1; min-height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--white); }
.note { padding: 12px 14px; border-radius: 12px; background: var(--white); border: 1px solid var(--line-soft); font-size: 14px; }
.note small { display: block; color: var(--muted-2); font-size: 12px; margin-bottom: 2px; }

/* Statement */
.statement { display: flex; flex-direction: column; font-size: 15px; font-variant-numeric: tabular-nums; }
.statement > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.statement > div.total { border-top: 1.5px solid var(--ink); font-weight: 600; font-size: 17px; }

/* Breeding */
.mare { display: flex; flex-direction: column; gap: 14px; }
.mare-status { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 20; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px; background: var(--ink); color: var(--paper); font-size: 14px; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .4); transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

.empty { padding: 18px; text-align: center; color: var(--muted-2); font-size: 14px; }
