/* ============================================================
   Fabiss — Admin panel (desktop) design system
   Brand tokens shared with the mobile app (CLAUDE.md §8), light mode only.
   Layout: fixed left sidebar + topbar + scrollable content.
   ============================================================ */

:root {
  --bg: #FFFFFF;
  --bg-app: #F6EFE4;            /* app canvas behind cards */
  --bg-secondary: #F2E8DA;
  --brown: #402005;
  --brown-soft: #6B4A2B;
  --cream: #F2E8DA;
  --cream-deep: #E8D9C4;
  --primary: #3E7C47;
  --primary-dark: #2F6235;
  --primary-light: #D6EAD9;
  --accent: #C8761E;
  --accent-bg: #FBEAD3;
  --text: #2B1A0C;
  --text-secondary: #5A4636;
  --text-muted: #8A7A6A;
  --border: #E2D6C5;
  --border-light: #EFE7DA;
  --success: #2F7D12;
  --success-bg: #E3F2D6;
  --danger: #B23A2E;
  --danger-bg: #F7E2DF;
  --info: #2F6FB0;
  --info-bg: #E1EDF8;

  --r-sm: 8px; --r-md: 10px; --r-lg: 14px; --r-xl: 18px; --r-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(64,32,5,.06);
  --shadow-md: 0 6px 18px rgba(64,32,5,.09);
  --shadow-lg: 0 18px 44px rgba(64,32,5,.14);
  --sidebar-w: 246px;
  --topbar-h: 64px;
  --font: "Nunito", "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { font-family: var(--font); color: var(--text); background: var(--bg-app); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ============================================================
   Mockup banner (not part of the product)
   ============================================================ */
.mockbar {
  height: 40px; display: flex; align-items: center; gap: 14px; padding: 0 18px;
  background: var(--brown); color: #fff; font-size: 12.5px; font-weight: 700;
}
.mockbar .dot { width: 8px; height: 8px; border-radius: 50%; background: #76c98a; }
.mockbar .spacer { flex: 1; }
.mockbar select {
  font-family: inherit; font-weight: 700; font-size: 12.5px; color: var(--brown);
  background: #fff; border: 0; border-radius: var(--r-full); padding: 6px 12px; cursor: pointer;
}
.mockbar a.linkish { color: #f0dcc2; text-decoration: underline; }

/* ============================================================
   App shell
   ============================================================ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: calc(100vh - 40px); }

.sidebar {
  background: #fff; border-right: 1px solid var(--border); display: flex; flex-direction: column;
  overflow-y: auto;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 12px; }
.sidebar .brand img { height: 30px; width: auto; }
.sidebar .brand .tag { font-size: 11px; font-weight: 700; color: var(--text-muted); }
.nav-group { padding: 8px 12px; }
.nav-group .lbl { font-size: 10.5px; font-weight: 800; letter-spacing: .7px; text-transform: uppercase; color: var(--text-muted); padding: 8px 10px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--r-md);
  color: var(--text-secondary); font-weight: 700; font-size: 14px; cursor: pointer; margin-bottom: 2px;
}
.nav-item svg { width: 19px; height: 19px; flex: none; }
.nav-item:hover { background: var(--cream); color: var(--brown); }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.nav-item .count { margin-left: auto; background: var(--accent-bg); color: var(--accent); font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: var(--r-full); }
.nav-item.active .count { background: rgba(255,255,255,.25); color: #fff; }
.sidebar .foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--border-light); display: flex; align-items: center; gap: 10px; }
.sidebar .foot .av { width: 36px; height: 36px; border-radius: 50%; background: var(--brown); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.sidebar .foot b { font-size: 13px; display: block; }
.sidebar .foot span { font-size: 11px; color: var(--text-muted); }

/* Main column */
.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.topbar {
  height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 16px; padding: 0 26px;
  background: rgba(255,255,255,.86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.topbar .search {
  flex: 1; max-width: 420px; display: flex; align-items: center; gap: 9px; background: var(--cream);
  border: 1px solid var(--border); border-radius: var(--r-full); padding: 9px 15px; color: var(--text-muted);
}
.topbar .search input { border: 0; background: transparent; outline: none; font-family: inherit; font-size: 14px; width: 100%; color: var(--text); }
.topbar .spacer { flex: 1; }
.topbar .tdate { font-size: 13px; font-weight: 700; color: var(--text-secondary); display: flex; align-items: center; gap: 7px; }
.topbar .ico-btn { width: 40px; height: 40px; border-radius: var(--r-md); border: 1px solid var(--border); background: #fff; display: grid; place-items: center; color: var(--text-secondary); position: relative; }
.topbar .ico-btn .badge-dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; border: 2px solid #fff; }

.content { flex: 1; overflow-y: auto; padding: 26px; }

/* Views */
.view { display: none; }
.view.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -.4px; }
.page-head .sub { color: var(--text-muted); font-weight: 600; font-size: 13.5px; margin-top: 3px; }
.page-head .actions { display: flex; gap: 10px; flex: none; }

/* ============================================================
   Buttons
   ============================================================ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; font-weight: 800; font-size: 14px; padding: 10px 16px; border-radius: var(--r-md); transition: filter .15s, transform .06s; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 6px 14px rgba(62,124,71,.25); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.dark { background: var(--brown); color: #fff; }
.btn.outline { background: #fff; color: var(--text); border: 1.5px solid var(--border); }
.btn.ghost { background: var(--cream); color: var(--brown); }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn.danger { background: var(--danger-bg); color: var(--danger); }

/* ============================================================
   Cards & layout helpers
   ============================================================ */
.card { background: #fff; border: 1px solid var(--border-light); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 18px; }
.card .card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card .card-head h3 { font-size: 15.5px; font-weight: 800; }
.card .card-head .link { font-size: 13px; font-weight: 700; color: var(--primary); }
.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.span-2 { grid-column: span 2; }
.row { display: flex; gap: 12px; align-items: center; }
.muted { color: var(--text-muted); }
.tiny { font-size: 12px; }
.mt { margin-top: 18px; }
.section-title { font-size: 16px; font-weight: 800; margin: 22px 0 12px; }

@media (max-width: 1200px) { .cols-4 { grid-template-columns: repeat(2,1fr); } .cols-3 { grid-template-columns: 1fr 1fr; } }

/* ============================================================
   KPI / stat cards
   ============================================================ */
.kpi { background: #fff; border: 1px solid var(--border-light); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.kpi .top { display: flex; align-items: center; justify-content: space-between; }
.kpi .ic { width: 38px; height: 38px; border-radius: var(--r-md); display: grid; place-items: center; }
.kpi .ic.green { background: var(--primary-light); color: var(--primary-dark); }
.kpi .ic.amber { background: var(--accent-bg); color: var(--accent); }
.kpi .ic.brown { background: var(--cream); color: var(--brown); }
.kpi .ic.info { background: var(--info-bg); color: var(--info); }
.kpi .val { font-size: 28px; font-weight: 800; color: var(--text); margin-top: 12px; letter-spacing: -.5px; }
.kpi .lbl { font-size: 13px; color: var(--text-muted); font-weight: 700; }
.kpi .delta { font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; gap: 3px; margin-top: 6px; }
.kpi .delta.up { color: var(--success); }
.kpi .delta.down { color: var(--danger); }

/* ============================================================
   Tables
   ============================================================ */
.table-wrap { background: #fff; border: 1px solid var(--border-light); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data thead th { text-align: left; font-size: 11px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: var(--text-muted); padding: 13px 16px; background: var(--cream); border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #FBFAF7; cursor: pointer; }
table.data .who { display: flex; align-items: center; gap: 10px; }
table.data .who .av { width: 34px; height: 34px; border-radius: 50%; background: var(--cream); display: grid; place-items: center; color: var(--brown-soft); overflow: hidden; flex: none; font-weight: 800; font-size: 12px; }
table.data .who .av img { width: 100%; height: 100%; object-fit: cover; }
table.data .who b { font-weight: 800; display: block; font-size: 13.5px; }
table.data .who span { color: var(--text-muted); font-size: 12px; }
.cell-strong { font-weight: 800; }

/* Toolbar above tables (filters) */
.toolbar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filter { display: inline-flex; align-items: center; gap: 7px; background: #fff; border: 1.5px solid var(--border); border-radius: var(--r-md); padding: 8px 12px; font-weight: 700; font-size: 13px; color: var(--text-secondary); }
.filter.active { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-light); }
.seg-tabs { display: inline-flex; background: var(--cream); border: 1px solid var(--border); border-radius: var(--r-full); padding: 3px; }
.seg-tabs button { border: 0; background: transparent; font-weight: 800; font-size: 13px; color: var(--text-secondary); padding: 7px 15px; border-radius: var(--r-full); }
.seg-tabs button.active { background: #fff; color: var(--brown); box-shadow: var(--shadow-sm); }

/* ============================================================
   Badges
   ============================================================ */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 800; padding: 4px 10px; border-radius: var(--r-full); white-space: nowrap; }
.badge.green { background: var(--primary-light); color: var(--primary-dark); }
.badge.amber { background: var(--accent-bg); color: var(--accent); }
.badge.cream { background: var(--cream); color: var(--brown-soft); }
.badge.red { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.gray { background: #EFEAE2; color: var(--text-muted); }
.dot-i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* ============================================================
   Charts (pure CSS)
   ============================================================ */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bars .bar i { width: 100%; max-width: 34px; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, var(--primary), var(--primary-dark)); display: block; }
.bars .bar i.amber { background: linear-gradient(180deg, var(--accent), #a85f12); }
.bars .bar small { font-size: 11px; color: var(--text-muted); font-weight: 700; }
.legend { display: flex; gap: 16px; margin-top: 8px; }
.legend span { font-size: 12px; font-weight: 700; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }

/* Donut via conic-gradient */
.donut { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto; }
.donut .hole { width: 96px; height: 96px; background: #fff; border-radius: 50%; display: grid; place-items: center; text-align: center; }
.donut .hole b { font-size: 24px; font-weight: 800; color: var(--brown); display: block; }
.donut .hole span { font-size: 11px; color: var(--text-muted); font-weight: 700; }

/* Sparkline-ish progress */
.meter { height: 10px; background: var(--cream); border-radius: var(--r-full); overflow: hidden; border: 1px solid var(--border); }
.meter > i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: var(--r-full); }

/* ============================================================
   List rows / today board
   ============================================================ */
.list { display: flex; flex-direction: column; }
.lrow { display: flex; align-items: center; gap: 14px; padding: 13px 4px; border-bottom: 1px solid var(--border-light); }
.lrow:last-child { border-bottom: 0; }
.lrow .av { width: 40px; height: 40px; border-radius: 50%; background: var(--cream); display: grid; place-items: center; color: var(--brown-soft); overflow: hidden; flex: none; }
.lrow .av img { width: 100%; height: 100%; object-fit: cover; }
.lrow .grow { flex: 1; min-width: 0; }
.lrow .grow b { font-weight: 800; font-size: 14px; }
.lrow .grow span { color: var(--text-muted); font-size: 12.5px; display: block; }
.lrow .when { font-weight: 800; font-size: 13px; color: var(--brown); }

/* ============================================================
   Kennel / occupancy board
   ============================================================ */
.kennels { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.kennel { border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px; background: #fff; }
.kennel.occupied { border-color: var(--primary); background: #FBFDFB; }
.kennel.free { background: var(--cream); border-style: dashed; }
.kennel .code { font-weight: 800; font-size: 13px; color: var(--brown); display: flex; justify-content: space-between; align-items: center; }
.kennel .pet { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.kennel .pet .av { width: 30px; height: 30px; border-radius: 50%; background: var(--cream-deep); overflow: hidden; }
.kennel .pet .av img { width: 100%; height: 100%; object-fit: cover; }
.kennel .pet b { font-size: 13px; font-weight: 800; }

/* ============================================================
   Detail / drawer panel (two-column detail pages)
   ============================================================ */
.detail-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .detail-grid { grid-template-columns: 1fr; } }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border-light); font-size: 13.5px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--text-secondary); font-weight: 600; }
.kv b { font-weight: 800; }
.profile-head { display: flex; align-items: center; gap: 14px; }
.profile-head .av { width: 64px; height: 64px; border-radius: 50%; background: var(--cream); display: grid; place-items: center; color: var(--brown-soft); overflow: hidden; font-weight: 800; font-size: 20px; }
.profile-head .av img { width: 100%; height: 100%; object-fit: cover; }
.profile-head h2 { font-size: 20px; font-weight: 800; }
.profile-head .sub { color: var(--text-muted); font-weight: 600; font-size: 13px; }

/* Alert / callout */
.callout { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--r-md); padding: 13px 15px; font-size: 13.5px; line-height: 1.5; }
.callout .ic { flex: none; margin-top: 1px; }
.callout.warn { background: var(--accent-bg); color: var(--text-secondary); border: 1px solid #F0D8B4; }
.callout.warn .ic { color: var(--accent); }
.callout.danger { background: var(--danger-bg); color: var(--text-secondary); border: 1px solid #ECC4BF; }
.callout.danger .ic { color: var(--danger); }
.callout.info { background: var(--info-bg); color: var(--text-secondary); border: 1px solid #C9DDF1; }
.callout.info .ic { color: var(--info); }
.callout b { color: var(--text); }

/* Forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 800; color: var(--text-secondary); margin-bottom: 6px; }
.input, .textarea, select.input { width: 100%; border: 1.5px solid var(--border); border-radius: var(--r-md); padding: 11px 13px; font-family: inherit; font-size: 14px; color: var(--text); background: #fff; }
.input:focus, .textarea:focus { outline: none; border-color: var(--primary); }
.textarea { min-height: 90px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* Toggle pill */
.toggle { width: 42px; height: 24px; border-radius: var(--r-full); background: var(--border); position: relative; flex: none; }
.toggle.on { background: var(--primary); }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle.on::after { left: 20px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--border-light); }
.switch-row:last-child { border-bottom: 0; }
.switch-row b { font-size: 14px; font-weight: 700; }
.switch-row span { font-size: 12px; color: var(--text-muted); }

/* Channel composer */
.chan-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.chan { display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--border); border-radius: var(--r-md); padding: 9px 14px; font-weight: 800; font-size: 13px; color: var(--text-secondary); background: #fff; }
.chan.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }

/* Camera grid */
.cams { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px,1fr)); gap: 16px; }
.cam { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); background: #14100b; position: relative; aspect-ratio: 16/10; display: grid; place-items: center; }
.cam img { width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.cam .live { position: absolute; top: 10px; left: 10px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: var(--r-full); display: flex; align-items: center; gap: 5px; }
.cam .live i { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: blink 1.2s infinite; }
.cam .meta { position: absolute; bottom: 0; left: 0; right: 0; padding: 10px; background: linear-gradient(transparent, rgba(0,0,0,.7)); color: #fff; font-size: 12px; font-weight: 700; display: flex; justify-content: space-between; }
@keyframes blink { 50% { opacity: .25; } }

/* Media gallery (admin) */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 12px; }
.media { aspect-ratio: 1/1; border-radius: var(--r-md); overflow: hidden; background: var(--cream-deep); display: grid; place-items: center; color: var(--brown-soft); position: relative; }
.media img { width: 100%; height: 100%; object-fit: cover; }
.media.upload { border: 2px dashed var(--border); background: var(--cream); cursor: pointer; flex-direction: column; gap: 6px; font-weight: 700; font-size: 12px; color: var(--text-muted); }

/* Timeline */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl { position: relative; padding-bottom: 14px; }
.tl::before { content: ""; position: absolute; left: -21px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--border); }
.tl.done::before { background: var(--primary); border-color: var(--primary); }
.tl.active::before { background: var(--accent); border-color: var(--accent-bg); box-shadow: 0 0 0 3px var(--accent-bg); }
.tl b { font-size: 13.5px; font-weight: 800; }
.tl span { font-size: 12px; color: var(--text-muted); }

/* Avatars colorize */
.av.green { background: var(--primary-light); color: var(--primary-dark); }
.av.amber { background: var(--accent-bg); color: var(--accent); }

/* Occupancy calendar mini */
.occ-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 5px; }
.occ-grid .d { aspect-ratio: 1/1; border-radius: 6px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--cream); color: var(--text-secondary); }
.occ-grid .d.low { background: var(--primary-light); }
.occ-grid .d.mid { background: #9FC9A6; color: #1f4d28; }
.occ-grid .d.high { background: var(--primary); color: #fff; }
.occ-grid .d.full { background: var(--accent); color: #fff; }

/* helper text */
.hint { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
hr.sep { border: 0; border-top: 1px solid var(--border-light); margin: 14px 0; }
