/* Koal Pot Staff - fonts, reset, app shell, splash */

/* No @font-face. The interface uses the reference demo's font stack, which
   resolves to Inter where installed and to the system interface font
   otherwise. The client's Koal Pot Display and Manrope files are logo
   artwork and live in assets/fonts/logo-only/ - see the README there. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--kp-font-body);
  font-size: var(--kp-fs-base);
  line-height: 1.5;
  color: var(--kp-ink);
  background: var(--kp-paper);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
img, svg { max-width: 100%; display: block; }
svg { flex-shrink: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .6; }
a { color: inherit; text-decoration: none; }
p { margin: 0; line-height: 1.55; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 800; }
h1 { font-size: clamp(25px, 3.2vw, var(--kp-fs-3xl)); letter-spacing: -1.2px; }
h2 { font-size: var(--kp-fs-xl); letter-spacing: -.4px; }
h3 { font-size: var(--kp-fs-lg); font-weight: 700; }
small { font-size: var(--kp-fs-md); color: var(--kp-muted); }

/* Kept so existing call sites stay valid: branded headings are simply bold. */
.kp-display { font-weight: 800; letter-spacing: -.4px; }
.num { font-variant-numeric: tabular-nums lining-nums; }

:focus-visible { outline: 3px solid #ED9EAC; outline-offset: 2px; border-radius: 5px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* =========================================================================
   Shell: dark sidebar on desktop, top bar + bottom nav on phones
   ========================================================================= */
.layout {
  display: grid;
  grid-template-columns: var(--kp-sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  background: var(--kp-sidebar); color: #fff;
  display: flex; flex-direction: column;
  padding: 28px 17px 22px;
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  overflow-y: auto;
}
.app-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.app-brand img { display: block; width: 110px; height: auto; flex-shrink: 0; }
.app-brand span { font-size: var(--kp-fs-sm); font-weight: 800; white-space: nowrap; }
.brand { padding: 5px 13px 28px; }
.nav-caption {
  font-size: var(--kp-fs-xs); color: var(--kp-sidebar-mu); font-weight: 800;
  letter-spacing: 1.65px; padding: 9px 15px 11px;
}
.nav-list { display: grid; gap: 5px; }
.nav-link {
  width: 100%; display: flex; align-items: center; gap: 13px; text-align: left;
  padding: 12px 15px; color: var(--kp-sidebar-tx); border: 0; background: none;
  border-radius: 11px; font-weight: 600; font-size: var(--kp-fs-base);
  position: relative; min-height: var(--kp-tapmin);
}
.nav-link:hover { background: var(--kp-sidebar-2); color: #fff; }
.nav-link[aria-current="page"] { background: var(--kp-red-deep); color: #fff; }
.nav-link svg { width: 18px; height: 18px; }
.nav-link .count {
  margin-left: auto; background: #ffffff26; color: #fff; border-radius: 8px;
  padding: 2px 7px; font-size: var(--kp-fs-xs);
}
.nav-link[aria-current="page"] .count { background: #ffffff33; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid #313638; padding: 17px 12px 0; }
.sidebar-bottom .help {
  display: flex; gap: 9px; align-items: flex-start; color: #BFC1C2;
  font-size: var(--kp-fs-md); line-height: 1.45;
}
.sidebar-bottom .help svg { width: 16px; height: 16px; margin-top: 1px; }
.side-action {
  background: #303637; border-radius: 10px; padding: 11px 12px; color: #D2D8DA;
  margin-top: 10px; width: 100%; border: 1px solid #3B4142; display: flex;
  align-items: center; gap: 9px; text-align: left; font-size: var(--kp-fs-md);
  min-height: var(--kp-tapmin);
}
.side-action span { flex: 1; }
.side-action:hover { background: #3a4142; color: #fff; }
.side-action svg { width: 15px; height: 15px; }

.main {
  padding: 28px clamp(19px, 3vw, 48px) 100px;
  max-width: var(--kp-maxw); width: 100%; margin: 0 auto; min-width: 0;
}

/* Desktop header line */
.topbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 15px; margin-bottom: 26px;
}
.eyebrow-line {
  font-size: var(--kp-fs-md); font-weight: 700; color: #8A9095;
  letter-spacing: .05em; margin-bottom: 9px;
}
.topbar .tagline { color: var(--kp-muted); font-size: var(--kp-fs-base); margin-top: 8px; }
.top-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.pill-control {
  border: 1px solid #E2E2E3; background: #fff; border-radius: var(--kp-r-pill);
  padding: 9px 13px; display: inline-flex; align-items: center; gap: 8px;
  color: #444C50; font-size: var(--kp-fs-md); font-weight: 700;
  min-height: var(--kp-tapmin);
}
.pill-control svg { width: 16px; height: 16px; }
.top-avatar {
  width: 39px; height: 39px; background: #F2DBDF; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; color: var(--kp-danger);
  box-shadow: 0 0 0 3px #fff; flex: none; font-size: var(--kp-fs-base);
  overflow: hidden;
}
.top-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Mobile header */
.mobile-top { display: none; }
.bottom-nav { display: none; }

/* =========================================================================
   Splash
   ========================================================================= */
#kp-splash {
  position: fixed; inset: 0; z-index: 99999; background: #fff; color: #161616;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: max(24px, var(--kp-safe-top)) 22px max(24px, var(--kp-safe-bottom));
  transition: opacity .52s ease, visibility .52s ease;
}
#kp-splash[hidden] { display: none !important; }
#kp-splash.is-hiding { opacity: 0; visibility: hidden; pointer-events: none; }
.kp-splash__body {
  width: min(390px, 100%); display: flex; flex-direction: column;
  align-items: center; text-align: center; transform: translateY(-7px);
}
.kp-splash__logo {
  display: block; width: min(100%, 366px); height: auto; object-fit: contain;
  animation: kp-intro-in .8s cubic-bezier(.2, .7, .2, 1) both;
}
.kp-splash__subtitle {
  margin-top: 16px; font: 700 10px/1.4 var(--kp-font-body);
  letter-spacing: .34em; text-indent: .34em; color: #B61B3A;
  animation: kp-intro-in .85s .12s both;
}
.kp-splash__bar {
  width: 154px; height: 3px; border-radius: 20px; background: #F4E3E8;
  overflow: hidden; margin-top: 34px; animation: kp-intro-in .8s .3s both;
}
.kp-splash__bar i {
  display: block; width: 42%; height: 100%; border-radius: 20px;
  background: var(--kp-red); animation: kp-progress 1.3s ease-in-out infinite;
}
.kp-splash__label {
  color: #8C8184; font: 500 11px/1.5 var(--kp-font-body); margin-top: 13px;
  animation: kp-intro-in .8s .32s both;
}
.kp-splash__footer {
  position: absolute; bottom: max(30px, var(--kp-safe-bottom));
  font: 600 9px/1.5 var(--kp-font-body); letter-spacing: .25em;
  text-indent: .25em; color: #B3A8AB;
}
@keyframes kp-intro-in {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes kp-progress {
  0%   { transform: translateX(-110%); }
  50%  { transform: translateX(125%); }
  100% { transform: translateX(330%); }
}
@media (prefers-reduced-motion: reduce) {
  .kp-splash__logo, .kp-splash__subtitle, .kp-splash__bar, .kp-splash__label { animation: none; }
  .kp-splash__bar i { animation: none; width: 100%; }
  #kp-splash { transition: none; }
}

/* =========================================================================
   Phone layout
   ========================================================================= */
@media (max-width: 1060px) {
  .layout { grid-template-columns: 210px minmax(0, 1fr); }
  .sidebar { padding-left: 10px; padding-right: 10px; }
  .main { padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 760px) {
  .layout { display: block; }
  .sidebar { display: none; }
  .main {
    padding: 16px 16px calc(84px + var(--kp-safe-bottom));
    padding-left: max(16px, var(--kp-safe-left));
    padding-right: max(16px, var(--kp-safe-right));
  }

  .mobile-top {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; margin-bottom: 18px;
    padding-top: var(--kp-safe-top);
  }
  .mobile-brand img { width: clamp(72px, 23vw, 100px); }
  .mobile-brand span { color: var(--kp-ink); }
  .mobile-actions { display: flex; align-items: center; gap: 7px; margin-left: auto; }
  .icon-pill {
    border: 1px solid var(--kp-line); background: #fff; border-radius: var(--kp-r-pill);
    width: 40px; height: 40px; display: grid; place-items: center; position: relative;
    color: #3A3F44;
  }
  .icon-pill svg { width: 17px; height: 17px; }
  .icon-pill .dot {
    position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px;
    padding: 0 4px; border-radius: var(--kp-r-pill); background: var(--kp-red);
    color: #fff; font-size: var(--kp-fs-xs); line-height: 16px; font-weight: 500;
  }
  .view-pill {
    border: 1px solid var(--kp-line); background: #fff; border-radius: var(--kp-r-pill);
    padding: 9px 12px; font-size: var(--kp-fs-sm); font-weight: 800; color: #30363A;
    display: inline-flex; align-items: center; gap: 5px; min-height: 40px;
    white-space: nowrap;
  }
  .view-pill svg { width: 13px; height: 13px; }
  .icon-pill .top-avatar { box-shadow: none; }

  .topbar { margin-bottom: 16px; }
  .top-actions { display: none; }
  h1 { font-size: 26px; }

  .bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    display: flex; justify-content: space-around; background: #fff;
    border-top: 1px solid #E8E8E8;
    padding: 9px 7px calc(9px + var(--kp-safe-bottom));
    box-shadow: 0 -10px 30px #0000000a;
  }
  .bottom-nav a {
    border: 0; background: none; color: #848990; min-width: 56px;
    display: grid; justify-items: center; gap: 4px; font-size: var(--kp-fs-xs);
    font-weight: 700; padding: 2px; position: relative;
  }
  .bottom-nav a svg { width: 20px; height: 20px; }
  .bottom-nav a[aria-current="page"] { color: var(--kp-red); }
  .bottom-nav .dot {
    position: absolute; top: -2px; right: 50%; margin-right: -20px;
    min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--kp-r-pill);
    background: var(--kp-red); color: #fff; font-size: 9px; line-height: 16px;
  }
}
