/* Financial UI — Noesis visual system (tokens/forms/tables/flatpickr) adapted for FastAPI shell */

@import url("roboto-faces.css");

:root {
  --primary-color: #ffffff;
  --sidebar-text: #5f6368;
  --sidebar-active-bg: #e8f0fe;
  --sidebar-active-text: #1967d2;
  --accent-color: #1a73e8;
  --accent-hover: #1765cc;
  --accent-soft: rgba(26, 115, 232, 0.12);
  --background-light: #f7f8fa;
  --card-bg: #ffffff;
  --text-dark: #202124;
  --text-muted: #5f6368;
  --border-color: #dadce0;
  --sidebar-width: 250px;
  --danger: #d93025;
  --ok: #188038;
  --warn: #e37400;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(60, 64, 67, 0.12), 0 1px 3px rgba(60, 64, 67, 0.08);
  --font-ui: "Roboto", system-ui, sans-serif;
  --side-w: var(--sidebar-width);
  --ink: var(--text-dark);
  --ink-soft: #3c4043;
  --muted: var(--text-muted);
  --line: var(--border-color);
  --accent: var(--accent-color);
  --accent-deep: var(--accent-hover);
  --panel: var(--card-bg);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-dark);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  line-height: 1.45;
  background: var(--background-light);
}
a { color: var(--accent-color); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  background: var(--primary-color);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.side::-webkit-scrollbar { width: 0; height: 0; }
.side-brand {
  display: block;
  padding: 1.1rem 1.25rem 0.85rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: -0.02em;
  text-decoration: none !important;
  border-bottom: 1px solid var(--border-color);
}
.side-brand span {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}
.side-nav { flex: 1; padding: 0.4rem 0.5rem 0.75rem; }
.nav-group + .nav-group { margin-top: 0.2rem; }
.nav-group-label {
  padding: 0.45rem 0.7rem 0.15rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #80868b;
}
.side-nav a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.28rem 0.7rem;
  margin: 0;
  min-height: 1.85rem;
  border-radius: 0 18px 18px 0;
  color: var(--sidebar-text);
  font-weight: 500;
  font-size: 0.84rem;
  line-height: 1.2;
  text-decoration: none !important;
}
.side-nav a:hover { background: #f1f3f4; color: var(--text-dark); }
.side-nav a.on {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 500;
}
.side-nav .nav-ico {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: 18px 18px;
  mask-size: 18px 18px;
  opacity: 0.88;
}
.side-nav a.on .nav-ico { opacity: 1; }
.side-nav .nav-label { min-width: 0; }

/* Filled Material-style glyphs — reliable CSS masks (Noesis / Google blue sidebar) */
.side-nav a[data-icon="home"] .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z'/%3E%3C/svg%3E");
}
.side-nav a[data-icon="customers"] .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M16.5 13c-1.2 0-3.07.34-4.5 1-1.43-.67-3.3-1-4.5-1C5.33 13 1 14.08 1 16.25V19h22v-2.75C23 14.08 18.67 13 16.5 13zm-4 0c.22 0 .55.02.93.05-.7-.86-1.18-1.93-1.18-3.05 0-.21.02-.42.04-.62-.26-.02-.52-.03-.79-.03-2.33 0-4.5 1.67-4.5 4.5V13zm4-2c1.93 0 3.5-1.57 3.5-3.5S18.43 4 16.5 4 13 5.57 13 7.5s1.57 3.5 3.5 3.5zM9 4C6.79 4 5 5.79 5 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M16.5 13c-1.2 0-3.07.34-4.5 1-1.43-.67-3.3-1-4.5-1C5.33 13 1 14.08 1 16.25V19h22v-2.75C23 14.08 18.67 13 16.5 13zm-4 0c.22 0 .55.02.93.05-.7-.86-1.18-1.93-1.18-3.05 0-.21.02-.42.04-.62-.26-.02-.52-.03-.79-.03-2.33 0-4.5 1.67-4.5 4.5V13zm4-2c1.93 0 3.5-1.57 3.5-3.5S18.43 4 16.5 4 13 5.57 13 7.5s1.57 3.5 3.5 3.5zM9 4C6.79 4 5 5.79 5 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4z'/%3E%3C/svg%3E");
}
.side-nav a[data-icon="vendors"] .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M20 4H4v2l8 5 8-5V4zM4 8.5V20h16V8.5l-8 5-8-5z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M20 4H4v2l8 5 8-5V4zM4 8.5V20h16V8.5l-8 5-8-5z'/%3E%3C/svg%3E");
}
.side-nav a[data-icon="sales"] .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zm1 7V3.5L19.5 9H15zM8 13h8v2H8v-2zm0 4h5v2H8v-2z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zm1 7V3.5L19.5 9H15zM8 13h8v2H8v-2zm0 4h5v2H8v-2z'/%3E%3C/svg%3E");
}
.side-nav a[data-icon="collections"] .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm.5 15.5v1h-1v-1.05c-1.8-.2-3.2-1.25-3.4-3.05h1.55c.2 1 .95 1.55 2.05 1.55 1.1 0 1.9-.6 1.9-1.45 0-.95-.75-1.35-2.15-1.7-1.85-.45-3.1-1.2-3.1-3.05 0-1.55 1.2-2.65 2.9-2.9V6.5h1v1.05c1.55.25 2.75 1.3 2.9 2.9h-1.55c-.15-.9-.8-1.45-1.7-1.45-.95 0-1.65.55-1.65 1.35 0 .85.65 1.2 2.15 1.6 1.95.5 3.15 1.3 3.15 3.2 0 1.7-1.25 2.8-3.05 3.05z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm.5 15.5v1h-1v-1.05c-1.8-.2-3.2-1.25-3.4-3.05h1.55c.2 1 .95 1.55 2.05 1.55 1.1 0 1.9-.6 1.9-1.45 0-.95-.75-1.35-2.15-1.7-1.85-.45-3.1-1.2-3.1-3.05 0-1.55 1.2-2.65 2.9-2.9V6.5h1v1.05c1.55.25 2.75 1.3 2.9 2.9h-1.55c-.15-.9-.8-1.45-1.7-1.45-.95 0-1.65.55-1.65 1.35 0 .85.65 1.2 2.15 1.6 1.95.5 3.15 1.3 3.15 3.2 0 1.7-1.25 2.8-3.05 3.05z'/%3E%3C/svg%3E");
}
.side-nav a[data-icon="checks"] .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M20 4H4c-1.11 0-2 .89-2 2v12c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4v-6h16v6zm0-10H4V6h16v2z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M20 4H4c-1.11 0-2 .89-2 2v12c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4v-6h16v6zm0-10H4V6h16v2z'/%3E%3C/svg%3E");
}
.side-nav a[data-icon="expenses"] .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19.5 3.5 18 2l-1.5 1.5L15 2l-1.5 1.5L12 2l-1.5 1.5L9 2 7.5 3.5 6 2v14H3v3c0 1.66 1.34 3 3 3h12c1.66 0 3-1.34 3-3V2l-1.5 1.5zM15 20H6c-.55 0-1-.45-1-1v-1h10v2zm4-1c0 .55-.45 1-1 1s-1-.45-1-1v-3H8V5h11v14z'/%3E%3Cpath fill='black' d='M9 7h6v2H9zm0 3h6v2H9zm0 3h4v2H9z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19.5 3.5 18 2l-1.5 1.5L15 2l-1.5 1.5L12 2l-1.5 1.5L9 2 7.5 3.5 6 2v14H3v3c0 1.66 1.34 3 3 3h12c1.66 0 3-1.34 3-3V2l-1.5 1.5zM15 20H6c-.55 0-1-.45-1-1v-1h10v2zm4-1c0 .55-.45 1-1 1s-1-.45-1-1v-3H8V5h11v14z'/%3E%3Cpath fill='black' d='M9 7h6v2H9zm0 3h6v2H9zm0 3h4v2H9z'/%3E%3C/svg%3E");
}
.side-nav a[data-icon="payments"] .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19 14V6c0-1.1-.9-2-2-2H3c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zm-9-1c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm13-6v11c0 1.1-.9 2-2 2H4v-2h17V7h2z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19 14V6c0-1.1-.9-2-2-2H3c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zm-9-1c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm13-6v11c0 1.1-.9 2-2 2H4v-2h17V7h2z'/%3E%3C/svg%3E");
}
.side-nav a[data-icon="orders"] .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm4 4h14v-2H7v2zm0 4h14v-2H7v2zM7 7v2h14V7H7z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm4 4h14v-2H7v2zm0 4h14v-2H7v2zM7 7v2h14V7H7z'/%3E%3C/svg%3E");
}
.side-nav a[data-icon="schedule"] .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19 4h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V10h14v10zm0-12H5V6h14v2z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19 4h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V10h14v10zm0-12H5V6h14v2z'/%3E%3C/svg%3E");
}
.side-nav a[data-icon="balances"] .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M13 7.83c.85-.3 1.53-.98 1.83-1.83H9.17c.3.85.98 1.53 1.83 1.83V3h2v4.83zM3 13h2v-2H3v2zm16 0h2v-2h-2v2zM5 21h14v-2H5v2zm7-3c-2.76 0-5-2.24-5-5H5c0 3.87 3.13 7 7 7s7-3.13 7-7h-2c0 2.76-2.24 5-5 5z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M13 7.83c.85-.3 1.53-.98 1.83-1.83H9.17c.3.85.98 1.53 1.83 1.83V3h2v4.83zM3 13h2v-2H3v2zm16 0h2v-2h-2v2zM5 21h14v-2H5v2zm7-3c-2.76 0-5-2.24-5-5H5c0 3.87 3.13 7 7 7s7-3.13 7-7h-2c0 2.76-2.24 5-5 5z'/%3E%3C/svg%3E");
}
.side-nav a[data-icon="aging"] .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z'/%3E%3C/svg%3E");
}
.side-nav a[data-icon="reports"] .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M5 9.2h3V19H5V9.2zM10.6 5h2.8v14h-2.8V5zm5.6 8H19v6h-2.8v-6z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M5 9.2h3V19H5V9.2zM10.6 5h2.8v14h-2.8V5zm5.6 8H19v6h-2.8v-6z'/%3E%3C/svg%3E");
}
.side-nav a[data-icon="series"] .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 5v14h3V5H3zm4 0v14h2V5H7zm3 0v14h1V5h-1zm2 0v14h3V5h-3zm4 0v14h1V5h-1zm2 0v14h3V5h-3z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 5v14h3V5H3zm4 0v14h2V5H7zm3 0v14h1V5h-1zm2 0v14h3V5h-3zm4 0v14h1V5h-1zm2 0v14h3V5h-3z'/%3E%3C/svg%3E");
}
.side-nav a[data-icon="settings"] .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19.14 12.94c.04-.31.06-.63.06-.94 0-.31-.02-.63-.06-.94l2.03-1.58a.49.49 0 0 0 .12-.61l-1.92-3.32a.49.49 0 0 0-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.48.48 0 0 0-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96a.49.49 0 0 0-.59.22L2.74 8.87a.48.48 0 0 0 .12.61l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58a.49.49 0 0 0-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32a.49.49 0 0 0-.12-.61l-2.01-1.58zM12 15.6A3.6 3.6 0 1 1 12 8.4a3.6 3.6 0 0 1 0 7.2z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19.14 12.94c.04-.31.06-.63.06-.94 0-.31-.02-.63-.06-.94l2.03-1.58a.49.49 0 0 0 .12-.61l-1.92-3.32a.49.49 0 0 0-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.48.48 0 0 0-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96a.49.49 0 0 0-.59.22L2.74 8.87a.48.48 0 0 0 .12.61l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58a.49.49 0 0 0-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32a.49.49 0 0 0-.12-.61l-2.01-1.58zM12 15.6A3.6 3.6 0 1 1 12 8.4a3.6 3.6 0 0 1 0 7.2z'/%3E%3C/svg%3E");
}
.side-nav a[data-icon="companies"] .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 7V3H2v18h20V7H12zM6 19H4v-2h2v2zm0-4H4v-2h2v2zm0-4H4V9h2v2zm0-4H4V5h2v2zm4 12H8v-2h2v2zm0-4H8v-2h2v2zm0-4H8V9h2v2zm0-4H8V5h2v2zm10 12h-8v-2h2v-2h-2v-2h2v-2h-2V9h8v10zm-2-8h-2v2h2v-2zm0 4h-2v2h2v-2z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 7V3H2v18h20V7H12zM6 19H4v-2h2v2zm0-4H4v-2h2v2zm0-4H4V9h2v2zm0-4H4V5h2v2zm4 12H8v-2h2v2zm0-4H8v-2h2v2zm0-4H8V9h2v2zm0-4H8V5h2v2zm10 12h-8v-2h2v-2h-2v-2h2v-2h-2V9h8v10zm-2-8h-2v2h2v-2zm0 4h-2v2h2v-2z'/%3E%3C/svg%3E");
}
.side-nav a[data-icon="users"] .nav-ico {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E");
}
.side-foot {
  padding: 0.85rem 1rem 1.1rem;
  border-top: 1px solid var(--border-color);
}
.company-switch { margin-bottom: 0.65rem; }
.company-switch-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.company-switch select {
  width: 100%;
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.side-user { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.5rem; }
tr.is-current td { background: var(--sidebar-active-bg); }
.logout button, .btn-ghost, button.secondary, a.btn.secondary {
  background: #fff;
  border: 1px solid var(--border-color);
  color: var(--text-dark);
  box-shadow: none;
}
.workspace { padding: 1.35rem 1.75rem 2.5rem; max-width: 1520px; }

.hist-back {
  position: fixed;
  top: 0.85rem;
  right: 0.95rem;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: #fff;
  color: var(--text-muted);
  box-shadow: var(--shadow);
  cursor: pointer;
  line-height: 0;
}
.hist-back:hover {
  color: var(--accent-color);
  border-color: #c6dafc;
  background: #f8fbff;
  text-decoration: none;
}
.hist-back:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}
.eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
h1 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text-dark);
}
.title-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.ledger-name { margin: 0.85rem 0 0.15rem; font-size: 1.15rem; font-weight: 500; color: var(--text-dark); }
.ledger-reason { font-size: 0.75rem; color: var(--text-muted); }
.ledger-debit { color: var(--danger); }
.ledger-credit { color: var(--ok); }
.ledger-total td { font-weight: 700; border-top: 1px solid var(--border-color); }
tr.ledger-charge td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
tr.ledger-payment td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.ledger-amount-charge { color: var(--danger); font-weight: 500; }
.ledger-amount-payment { color: var(--ok); font-weight: 500; }
.title-row h1 a { color: inherit; text-decoration: none; }
.title-row h1 a:hover { color: var(--accent-color); }
.head-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--accent-color);
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none !important;
}
.head-add:hover {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #fff;
}
.head-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: #fff;
  color: #3c4043;
  cursor: pointer;
  text-decoration: none !important;
}
.head-ico:hover { background: var(--accent-color); border-color: var(--accent-color); color: #fff; }
.back-ico {
  position: fixed;
  top: 10px;
  right: 18px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background: #fff;
  color: var(--text-muted);
  box-shadow: var(--shadow);
  cursor: pointer;
  line-height: 0;
}
.back-ico:hover {
  color: var(--accent-color);
  border-color: #c6dafc;
  background: var(--accent-soft);
}
@media print { .back-ico { display: none !important; } }
h2 {
  font-size: 1.05rem;
  font-weight: 500;
  margin: 0 0 0.75rem;
}
.bal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border-color);
  background: #f8f9fa;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.bal-count {
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: #eceff1;
  color: var(--ink-soft);
  font-size: 0.72rem;
  letter-spacing: 0;
}
.bal-head-right {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
}
.bal-head-right b { color: var(--ink-soft); font-weight: 600; }
.flow-tag {
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}
.flow-tag.flow-in { background: #e6f4ea; color: var(--ok); }
.flow-tag.flow-out { background: #fce8e6; color: var(--danger); }
td.flow-in { color: var(--ok); }
td.flow-out { color: var(--danger); }

.btn, button[type="submit"]:not(.credit-hit):not(.filter-ico):not(.sched-x):not(.series-save):not(.series-del):not(.series-add-btn):not(.back-ico), button:not(.pg):not(.suggest button):not(.cal button):not(.icon-btn):not(.credit-hit):not(.head-ico):not(.head-add):not(.bank-remove):not(.email-chip-x):not(.hist-back):not(.filter-ico):not(.sched-x):not(.series-save):not(.series-del):not(.series-add-btn):not(.back-ico) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  border: 1px solid transparent;
  background: var(--accent-color);
  color: #fff;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none !important;
  box-shadow: none;
}
.btn:hover, button[type="submit"]:not(.credit-hit):hover { background: var(--accent-hover); color: #fff; }
.btn-ghost, button.secondary, a.btn.secondary {
  background: #fff;
  border-color: var(--border-color);
  color: var(--accent-color);
}
.btn-ghost:hover, button.secondary:hover { background: #f8f9fa; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }

.search, .list-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  padding-bottom: 0.15rem;
}
.preset {
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none !important;
}
.preset:hover { border-color: var(--accent-color); color: var(--accent-color); }
.preset.on {
  background: var(--sidebar-active-bg);
  border-color: transparent;
  color: var(--sidebar-active-text);
}
.search label, .list-filters label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}
.page-customers .hist-back,
.page-vendors .hist-back { display: none; }
.list-filters .search-line,
.list-filters .filter-row { display: contents; }
.list-filters.search-only label,
.list-filters.search-stack .search-line > label:first-child {
  width: 28rem;
  max-width: 100%;
}
.list-filters.search-only input[name="q"],
.list-filters.search-stack .search-line > label:first-child input[name="q"] { width: 100%; }
.list-filters.search-stack .search-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
  width: 100%;
}
.list-filters.search-stack .search-tools {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
}
.list-filters.search-stack .search-line input[name="mark"] { width: 11rem; }
.list-filters.search-stack {
  flex-direction: column;
  align-items: flex-start;
}
.list-filters.search-stack .filter-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.45rem;
  align-items: flex-end;
  width: 100%;
}
.list-filters .field-inline {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
}
#list-filters .btn.filter-ico {
  flex: 0 0 auto;
  width: 2.15rem;
  height: 2.15rem;
  min-height: 2.15rem;
  padding: 0;
  border-radius: 4px;
}
#list-filters .btn.filter-ico svg { display: block; }
#list-filters a.btn.filter-ico:hover {
  background: #f8f9fa;
  border-color: var(--accent-color);
  color: var(--accent-color);
}
input, select, textarea {
  font: inherit;
  color: var(--text-dark);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.45rem 0.65rem;
  background: #fff;
  min-height: 2.15rem;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}
.flatpickr-input, input.flatpickr-input, .flatpickr-alt-input {
  background: #fff;
}
input[type="date"],
.flatpickr-alt-input {
  width: 6.15rem !important;
  min-width: 0 !important;
  max-width: 6.15rem !important;
  padding-left: 0.3rem;
  padding-right: 0.3rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 28rem;
}
.stack input:not([type="date"]):not([type="checkbox"]):not([type="radio"]):not(.flatpickr-alt-input),
.stack select { width: 100%; }
input[type="checkbox"],
input[type="radio"] {
  width: 1rem;
  height: 1rem;
  min-height: 0;
  padding: 0;
  flex: 0 0 auto;
  accent-color: var(--accent-color);
}
.pay-methods { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; }
#deposit-fields,
#check-fields { display: flex; flex-direction: column; gap: 0.75rem; }
.bank-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.6rem;
  align-items: end;
}
button.bank-remove {
  width: 2.15rem;
  height: 2.15rem;
  margin-bottom: 0.05rem;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: #fff;
  color: var(--text-muted);
  font-size: 1.15rem;
  line-height: 1;
}
button.bank-remove:hover { color: var(--danger); border-color: var(--danger); background: #fff; }
.bg-current {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.15rem 0 0.5rem;
}
.bg-current code { overflow-wrap: anywhere; }
.bg-current .head-ico { flex: 0 0 auto; width: 1.7rem; height: 1.7rem; }
.bg-current .head-ico.is-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.bg-current .head-ico[disabled] { opacity: 0.55; cursor: default; }
.email-box {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  min-height: 2.4rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: #fff;
  cursor: text;
}
.email-box input {
  flex: 1;
  min-width: 12rem;
  padding: 0.2rem 0;
  border: 0;
  outline: none;
  background: transparent;
}
.email-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: #f4f6f8;
  font-size: 0.85rem;
}
.email-chip.invalid { border-color: var(--danger); color: var(--danger); }
.email-chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
}
.email-chip button:hover { color: #202124; background: rgba(0, 0, 0, 0.07); }
.stack label, form.stack label, .field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.field-inline {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink-soft) !important;
  font-weight: 500 !important;
}

.panel, .table-wrap, .card, .grid2 > section {
  border-radius: var(--radius);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card { padding: 1.15rem 1.2rem; overflow: visible; }
.table-scroll { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
th, td {
  text-align: left;
  padding: 0.28rem 0.75rem;
  line-height: 1.25;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}
th.sort-balance { cursor: pointer; user-select: none; }
th.sort-balance.is-desc::after { content: " ↓"; }
th.sort-balance.is-asc::after { content: " ↑"; }
th {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: #f8f9fa;
  position: sticky;
  top: 0;
}
.workspace tbody tr:nth-child(odd) { background: #fff; }
.workspace tbody tr:nth-child(even) { background: #f6f7f8; }
.workspace tbody tr:hover { background: #eef0f2; }
.workspace .sheet tbody tr:nth-child(n),
.workspace .sheet tbody tr:hover { background: transparent; }
.num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
tr.void td { opacity: 0.42; text-decoration: line-through; }
tr.credit td { color: var(--warn); }
tr.draft td { background: #fff8e1; }
tr.unsent td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
table.compact th, table.compact td { padding: 0.2rem 0.45rem; font-size: 0.82rem; }

.grid2 {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
}
.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 1.35rem;
}
.stat {
  min-width: 8.5rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}
.stat b {
  display: block;
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.stat span {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.balance-box {
  min-width: 9rem;
  margin-left: auto;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  text-align: right;
}
.balance-box span {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.balance-box strong {
  display: block;
  margin-top: 0.15rem;
  font-size: 1.35rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.vendor-ledger .num, .collections-list .num { text-align: center; }

.ok, .flash-ok { color: var(--ok); }
.muted { color: var(--text-muted); }
code {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.86em;
  background: #f1f3f4;
  padding: 0.12em 0.35em;
  border-radius: 4px;
}
.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  background: #e8f0fe;
  color: var(--sidebar-active-text);
}
.badge.warn { background: #fef7e0; color: #b06000; }
.badge.ok { background: #e6f4ea; color: var(--ok); }
.badge.muted { background: #f1f3f4; color: var(--text-muted); }

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin: 0.85rem 0 0;
}
.pager-info { font-size: 0.82rem; color: var(--text-muted); }
.pager-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.pg {
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-dark);
  font-weight: 500;
  font-size: 0.85rem;
  text-decoration: none !important;
}
.pg.is-current {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #fff;
}
.pg.is-disabled { opacity: 0.35; pointer-events: none; }
.pg-gap { padding: 0 0.2rem; color: var(--text-muted); }
.pager-size label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}
.pager-size select { width: auto; min-width: 4rem; }

.picker { position: relative; display: block; }
.picker input {
  padding-left: 2.15rem;
}
.picker input[type="search"]::-webkit-search-decoration,
.picker input[type="search"]::-webkit-search-cancel-button,
.picker input[type="search"]::-webkit-search-results-button {
  -webkit-appearance: none;
  appearance: none;
}
.picker-ico {
  position: absolute;
  z-index: 1;
  left: 0.65rem;
  top: 0;
  bottom: 0;
  margin: auto;
  width: 1rem;
  height: 1rem;
  pointer-events: none;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l5 5'/%3E%3C/svg%3E");
}
.picker.is-loading .picker-ico {
  background: none;
  border: 2px solid #dadce0;
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: picker-spin 0.7s linear infinite;
}
@keyframes picker-spin { to { transform: rotate(360deg); } }
.suggest {
  position: absolute;
  z-index: 40;
  left: 0; right: 0; top: calc(100% + 4px);
  max-height: 14rem;
  overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: #fff;
  box-shadow: 0 8px 24px rgba(60, 64, 67, 0.2);
  padding: 0.35rem;
}
.suggest button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.55rem 0.65rem;
  border-radius: 4px;
  font: inherit;
  color: var(--text-dark);
  cursor: pointer;
}
.suggest button:hover,
.suggest button.is-active { background: var(--sidebar-active-bg); }
.suggest button em { color: var(--text-muted); font-style: normal; font-size: 0.86em; margin-left: 0.35rem; }
.suggest-empty { display: block; padding: 0.65rem; color: var(--text-muted); }

.alert-ok, .alert.alert-ok,
.alert-bad, .alert.alert-bad {
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.alert-ok, .alert.alert-ok {
  background: #e6f4ea;
  border: 1px solid #ceead6;
  color: var(--ok);
}
.alert-bad, .alert.alert-bad {
  background: #fce8e6;
  border: 1px solid #f5c6c2;
  color: var(--danger);
}

.sale-customer { white-space: nowrap; }
.sale-customer .credit-hit { margin-right: 0.35rem; vertical-align: middle; }
.sale-credit-col { width: 2.6rem; text-align: center; }
.sale-credit-col form { margin: 0; }
.sale-actions-col { width: 6.6rem; text-align: right; white-space: nowrap; }
.mail-hit { color: #9aa0a6; }
.mail-hit.is-sent { color: #188038; }
.mail-hit.is-sent:hover { color: #137333; }
.sale-actions-col .credit-hit + .credit-hit { margin-left: 0.25rem; }
.sale-actions-col .credit-hit,
.sale-credit-col .credit-hit { vertical-align: middle; }
.credit-hit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: #fff;
  color: #3c4043;
  cursor: pointer;
  text-decoration: none !important;
}
.credit-hit:hover { background: #f8f9fa; color: var(--accent-color); }
.sale-actions { margin-bottom: 1rem; }
.sale-actions .toolbar { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.sale-actions form { display: inline-block; margin: 0.35rem 0.5rem 0 0; }

.sheet {
  --ink: #1a1a1a;
  --line: #1a1a1a;
  --head: #f4f5f7;
  position: relative;
  display: flex;
  flex-direction: column;
  width: 210mm;
  height: 297mm;
  max-width: 100%;
  margin: 0 auto 1.5rem;
  padding: 8mm;
  box-sizing: border-box;
  background: #fff;
  color: var(--ink);
  font-family: "Roboto", Arial, sans-serif;
  font-size: 11px;
  line-height: 1.35;
  border: 0;
  box-shadow: 0 10px 28px rgba(32, 33, 36, 0.1);
}
.sheet.has-bg {
  padding-top: 6mm;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.sheet.has-bg .sheet-brand {
  padding: 0 4.5mm 1mm;
  font-size: 13px;
  line-height: 1.35;
}
.sheet.has-bg .sheet-brand-name {
  font-size: 17px;
  margin-bottom: 1mm;
}
.sheet.has-bg .sheet-doc-title {
  margin-top: 22mm;
}
.sheet-bg {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: top center;
  pointer-events: none;
}
.sheet.has-bg > :not(.sheet-bg) { position: relative; z-index: 1; }
.sheet.has-bg .sheet-grid { background: transparent; }
.sheet.has-bg .sheet-fields { background: rgba(255, 255, 255, 0.9); }
.sheet.has-bg .sheet-table th { background: rgba(244, 245, 247, 0.88); }
.sheet-head,
.sheet-who {
  display: grid;
  grid-template-columns: 3fr 1fr;
}
.sheet-who {
  column-gap: 3mm;
  row-gap: 1.5mm;
  align-items: start;
}
.sheet-doc-title {
  width: max-content;
  max-width: 82%;
  margin: 1mm auto 2.5mm;
  padding: 1.6mm 7mm;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  line-height: 1.2;
  border: 0.35mm solid #202124;
  border-radius: 2mm;
  background: rgba(255, 255, 255, 0.92);
}
.sheet-who > .sheet-box { grid-column: 1; grid-row: 1; padding: 0; }
.sheet-who > .sheet-meta { grid-column: 2; grid-row: 1; }
.sheet-who .sheet-fields { margin: 0; }
.sheet-head { border: 0; }
.sheet-brand { padding: 4mm 4.5mm; }
.sheet-brand-name { font-size: 15px; font-weight: 700; margin-bottom: 1.5mm; }
.sheet-blank { border: 0; min-height: 24mm; }
.sheet-meta { display: block; }
.sheet-box { border: 0; padding: 3mm 4mm 3.5mm; }
.sheet-head + .sheet-box { border-top: 0; }
.sheet-box h2 {
  margin: 0 0 2mm;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.12em;
  font-weight: 700;
}
.sheet th,
.sheet td {
  border: 0;
  background: transparent;
}
.sheet-fields {
  width: 100%;
  margin: 1.5mm 0 0;
  border: 1px solid #e4e6ea;
  border-radius: 2.5mm;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  background: #fff;
}
.sheet-fields th {
  width: 32mm;
  text-align: left;
  font-weight: 600;
  color: #333;
  background: #f8f9fa;
  padding: 1.2mm 2mm 1.2mm 2.5mm;
  vertical-align: top;
  white-space: nowrap;
}
.sheet-fields td { padding: 1.2mm 2.5mm 1.2mm 1mm; vertical-align: top; font-weight: 600; }
.sheet-fields tr:first-child th:first-child { border-top-left-radius: 2.5mm; }
.sheet-fields tr:first-child td:last-child { border-top-right-radius: 2.5mm; }
.sheet-fields tr:last-child th:first-child { border-bottom-left-radius: 2.5mm; }
.sheet-fields tr:last-child td:last-child { border-bottom-right-radius: 2.5mm; }
.sheet-mark .sheet-fields { padding: 2mm 3.5mm 2.5mm; }
.sheet-mark .sheet-fields th,
.sheet-mark .sheet-fields td { padding: 1.2mm 3.5mm; }
.sheet-mark .sheet-fields th { width: 24mm; padding-left: 3.5mm; }
.sheet-grid {
  flex: 1 1 auto;
  min-height: 70mm;
  margin-top: 3mm;
  display: flex;
  border: 1px solid #e4e6ea;
  border-radius: 2.5mm;
  overflow: hidden;
  background: #fff;
}
.sheet-table {
  width: 100%;
  height: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
.sheet-table .c-price { width: 32mm; }
.sheet-table .c-vat { width: 18mm; }
.sheet-table .c-total { width: 34mm; }
.sheet-table th,
.sheet-table td {
  border: 0;
  border-right: 1px solid #e4e6ea;
  border-bottom: 1px solid #e4e6ea;
  padding: 2.2mm 2.5mm;
  vertical-align: top;
}
.sheet-table th:last-child,
.sheet-table td:last-child { border-right: 0; }
.sheet-table tr:last-child td { border-bottom: 0; }
.sheet-table th {
  background: var(--head);
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}
.sheet-table td:nth-child(n+2),
.sheet-table th:nth-child(n+2) { text-align: right; }
.sheet-table th:nth-child(n+2) { text-align: center; }
.sheet-fill td { height: 100%; }
.sheet-halves {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.sheet-halves > tbody > tr > td {
  width: 50%;
  vertical-align: top;
  border: 0;
  padding: 3mm 0 0;
}
.sheet-halves > tbody > tr > td + td { padding-left: 3mm; }
.sheet-halves h2 {
  margin: 0 0 2.5mm;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.12em;
  font-weight: 700;
}
.sheet-halves .sheet-fields th { width: 34mm; }
.sheet-account th, .sheet-account td { border-top: 0.2mm solid rgba(0, 0, 0, 0.12); }
.sheet-halves .sheet-totals td { text-align: right; font-variant-numeric: tabular-nums; }
.sheet-totals tr.is-total th,
.sheet-totals tr.is-total td {
  font-size: 13px;
  font-weight: 700;
  padding-top: 2mm;
  border: 0;
}
.sheet-oxygen {
  display: flex;
  gap: 4mm;
  align-items: center;
  font-size: 9.5px;
  line-height: 1.4;
  color: #222;
  overflow-wrap: anywhere;
}
.sheet-qr { width: 28mm; height: 28mm; flex: 0 0 auto; }
.sheet-oxygen-text { min-width: 0; }
.sheet-thanks {
  margin: 3mm 0 0;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 12px;
}
.sheet-draft {
  position: absolute;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%) rotate(-28deg);
  font-size: 64px;
  font-weight: 700;
  color: rgba(160, 160, 160, 0.35);
  letter-spacing: 0.08em;
  pointer-events: none;
}
.app-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(32, 33, 36, 0.45);
}
.app-modal[hidden] { display: none !important; }
.app-modal-card {
  width: min(26rem, 100%);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(32, 33, 36, 0.22);
  padding: 1.25rem 1.35rem 1.1rem;
}
.app-modal-text {
  margin: 0 0 1.15rem;
  white-space: pre-line;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text-dark);
}
.app-modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }
#app-modal-cancel {
  background: #fff;
  border: 1px solid var(--border-color);
  color: var(--text-dark);
}
#app-modal-cancel:hover { background: #f8f9fa; color: var(--text-dark); }
.app-modal-ok.is-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.app-modal-ok.is-danger:hover { background: #b3261e; color: #fff; }
@media print {
  .app-modal { display: none !important; }
  .side, .hist-back, .no-print { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
  .workspace { max-width: none; padding: 0; }
  .sheet {
    width: 210mm;
    height: 297mm;
    margin: 0;
    box-shadow: none;
  }
  @page { size: A4; margin: 0; }
}
.wait-cover {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(32, 33, 36, 0.35);
  place-items: center;
  backdrop-filter: blur(2px);
}
.wait-cover[hidden] { display: none !important; }
.wait-cover:not([hidden]) { display: grid; }
.wait-cover > div {
  background: #fff;
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(60, 64, 67, 0.2);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 12rem;
}
.wait-cover span { color: var(--text-muted); font-size: 0.88rem; }

/* Flatpickr — Noesis */
.flatpickr-calendar {
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 24px rgba(60, 64, 67, 0.2);
  border-radius: 8px;
  font-family: var(--font-ui);
}
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: var(--accent-color);
  border-color: var(--accent-color);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.85rem;
}
.kbd {
  font-size: 0.7rem;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  background: #f8f9fa;
  color: var(--text-muted);
}
.series-panel {
  margin-top: 1rem;  padding: 0.85rem 1rem;
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  background: #f8f9fa;
}
.corp-form { max-width: 52rem; }
.invoice-no-input {
  width: 5.5rem;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: #fff;
  color: inherit;
  font: inherit;
  font-size: 0.8em;
  text-align: center;
  vertical-align: middle;
}
.invoice-no-input:hover { border-color: var(--accent-color); }
.invoice-no-input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
#field-series .picker {
  width: 9rem;
  max-width: 100% !important;
}
#field-series .suggest { min-width: 14rem; }
#field-customer .picker {
  width: 100%;
  max-width: 100% !important;
}
#field-date input {
  width: 9rem !important;
  max-width: 9rem !important;
  align-self: flex-start !important;
  flex: 0 0 auto !important;
}
#field-series .picker input,
#field-customer .picker input,
#field-vendor .picker,
#field-vendor .picker input { width: 100%; }
#field-series .picker input { padding-left: 0.65rem; }
.invoice-lines { display: flex; flex-direction: column; gap: 0.55rem; margin: 0.25rem 0 0.35rem; }
.invoice-lines-head,
.invoice-line {
  display: grid;
  grid-template-columns: minmax(10rem, 1.8fr) 7.5rem 7rem 7rem 2.4rem;
  gap: 0.55rem;
  align-items: end;
}
.invoice-lines-head {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
  align-items: center;
}
.invoice-line .field { margin: 0; }
.invoice-line .desc-picker { width: 100%; }
.invoice-line .desc-picker input { width: 100%; padding-left: 0.65rem; }
.invoice-line .suggest { z-index: 30; }
.invoice-line .line-remove {
  min-width: 2.25rem;
  padding: 0.45rem 0.35rem;
  line-height: 1;
  font-size: 1.15rem;
}
.line-add { align-self: flex-start; min-width: 2.5rem; padding: 0.4rem 0.75rem; }
.invoice-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
  padding: 0.75rem 0.15rem 0.25rem;
  border-top: 1px solid var(--border-color);
  margin-top: 0.35rem;
}
.invoice-totals strong {
  display: block;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  margin-top: 0.15rem;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 720px) {
  .invoice-lines-head { display: none; }
  .invoice-line {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "desc desc"
      "net vat"
      "gross rm";
    align-items: stretch;
  }
  .invoice-line .line-desc { grid-area: desc; }
  .invoice-line .line-net { grid-area: net; }
  .invoice-line .line-vat { grid-area: vat; }
  .invoice-line .line-gross { grid-area: gross; }
  .invoice-line .line-remove { grid-area: rm; align-self: end; }
}
.auth .workspace, body.auth { display: grid; place-items: center; min-height: 100vh; }
body.auth {
  background: radial-gradient(120% 90% at 50% 0%, #ffffff 0%, #f1f4f8 45%, #e9eef4 100%);
  font-family: var(--font-ui);
}
.auth-stage { width: 100%; max-width: 25rem; padding: 1.25rem; }
.auth-panel {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 10px 34px rgba(32, 33, 36, 0.1), 0 1px 2px rgba(60, 64, 67, 0.06);
  padding: 1.9rem 1.75rem 1.5rem;
}
.auth-brand { display: flex; align-items: center; gap: 0.85rem; margin-bottom: 1.5rem; }
.auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-color);
  flex: 0 0 auto;
}
.auth-mark { margin: 0; font-size: 1.15rem; font-weight: 500; color: var(--text-dark); letter-spacing: 0.01em; }
.auth-tagline { margin: 0.15rem 0 0; font-size: 0.76rem; color: var(--text-muted); }
.auth-error {
  margin: 0 0 1rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: #fce8e6;
  border: 1px solid #f5c6c2;
  color: var(--danger);
  font-size: 0.8rem;
}
.auth-form { display: flex; flex-direction: column; gap: 0.85rem; }
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-muted);
}
.auth-form input, .auth-form select {
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #fff;
  color: var(--text-dark);
  font-family: inherit;
  font-size: 0.9rem;
}
.auth-form input:focus, .auth-form select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.auth-form button[type="submit"] { width: 100%; margin-top: 0.4rem; padding: 0.65rem 1rem; }
.auth-foot { margin: 1.2rem 0 0; text-align: center; font-size: 0.72rem; color: #9aa0a6; }

.sched-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.65rem;
  margin: 0.75rem 0;
}
.sched-grid > div {
  padding: 0.55rem;
  border-radius: 8px;
  background: #f8f9fa;
  border: 1px solid var(--border-color);
}
.sched-grid strong { display: block; font-size: 0.78rem; margin-bottom: 0.35rem; }
.sched-grid input { width: 100%; margin-top: 0.25rem; }

.sched-table td { vertical-align: middle; white-space: nowrap; }
.sched-table th, .sched-table td { text-align: center; border-right: 1px solid var(--border-color); }
.sched-table th:first-child, .sched-table td:first-child { text-align: left; }
.sched-table th:last-child, .sched-table td:last-child { border-right: 0; }
.sched-table .sched-cell { font-variant-numeric: tabular-nums; position: relative; }
.sched-table .sched-cell .sched-amt { display: block; }
.sched-table .sched-cell .sched-del { display: flex; justify-content: center; margin: 0.1rem 0 0; }
.sched-table .sched-cell.is-invoiced .sched-amt { color: var(--ok); font-weight: 500; }
.sched-table .sched-amt[draggable="true"] { cursor: grab; }
.sched-table .sched-cell.is-drag-source .sched-amt { cursor: grabbing; opacity: 0.4; }
.sched-table .sched-cell.is-drop-target {
  box-shadow: inset 0 0 0 2px var(--accent-color);
  background: var(--accent-soft);
}
.sched-table .sched-empty-row { display: none; }
.sched-table.is-dragging .sched-empty-row { display: table-row; }
.sched-table.is-dragging .sched-empty-row td { background: rgba(0, 0, 0, 0.015); }
.sched-pdf {
  position: absolute;
  top: 1px;
  right: 1px;
  display: inline-flex;
  line-height: 0;
  opacity: 0.85;
}
.sched-pdf:hover { opacity: 1; }
.sched-amt { color: var(--text-dark); }
.sched-del { display: inline; }
button.sched-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
  margin-left: 0.1rem;
}
button.sched-x:hover { color: #202124; background: rgba(0, 0, 0, 0.07); }
.app-modal-wide { width: min(32rem, 100%); }
.app-modal-wide > h2 { margin: 0 0 1rem; font-size: 1rem; font-weight: 500; }
.stack-tight { gap: 0.65rem; }
.sched-generate { padding: 1rem 1.15rem; }
.sched-generate h2 { font-size: 0.95rem; margin-bottom: 0.7rem; }
.sched-generate .search { margin: 0; }

/* —— Company series table —— */
.series-table { table-layout: fixed; width: 100%; }
.series-table th, .series-table td {
  vertical-align: middle;
  padding: 0.4rem 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.series-table .c-code { width: 4.4rem; }
.series-table .c-code .series-code {
  width: 100%;
  padding: 0.32rem 0.3rem;
  text-align: center;
  text-transform: uppercase;
}
.series-table .c-next { width: 4rem; text-align: right; }
.series-table .c-act { width: 5.2rem; text-align: right; white-space: nowrap; }
.series-table code { font-size: 0.78rem; }
.series-hidden-form { display: none; }
.series-row { display: flex; align-items: center; gap: 0.35rem; margin: 0; min-width: 0; }
.series-table .c-act .series-save { margin-right: 0.1rem; vertical-align: middle; }
.series-row .series-code,
.series-row .series-title {
  padding: 0.32rem 0.45rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: inherit;
  color: var(--text-dark);
  background: #fff;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.series-row .series-code { width: 3.2rem; flex: 0 0 3.2rem; }
.series-row .series-title { flex: 1 1 4rem; }
.series-row .series-code:focus, .series-row .series-title:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.series-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin: 0;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  flex: 0 0 auto;
}
.series-flag input { margin: 0; }
button.series-save, button.series-del, button.series-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #fff;
  color: var(--text-muted);
  line-height: 0;
  cursor: pointer;
  flex: 0 0 auto;
}
button.series-save:hover,
button.series-add-btn:hover { color: var(--accent-color); border-color: #c6dafc; background: var(--accent-soft); }
button.series-add-btn { margin-left: 0.1rem; }
button.series-del { width: 1.7rem; height: 1.7rem; border: 0; background: transparent; }
button.series-del:hover { color: var(--danger); background: rgba(217, 48, 37, 0.08); }
.series-default { font-size: 0.68rem; color: #9aa0a6; }
.series-add { margin-top: 0.9rem; }
.series-add h3 {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.series-add-row { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.series-add-row input:not([type="checkbox"]) {
  padding: 0.36rem 0.55rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
}
.series-add-row input[name="code"] { width: 7rem; }
.series-add-row input[name="title"] { flex: 1 1 12rem; }
.series-add-row input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.html-tip {
  position: fixed;
  z-index: 500;
  width: max-content;
  max-width: 22rem;
  padding: 0.32rem 0.55rem;
  border-radius: 6px;
  background: #202124;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.35;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(32, 33, 36, 0.28);
  white-space: normal;
  overflow-wrap: anywhere;
}
.html-tip[hidden] { display: none !important; }

/* —— Filter loading indicator —— */
.page-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 520;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
}
.page-progress[hidden] { display: none !important; }
.page-progress::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 35%;
  height: 100%;
  background: var(--accent-color);
  will-change: transform;
  animation: progress-slide 1.1s linear infinite;
}
@keyframes progress-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(286%); }
}
body.is-loading { cursor: progress; }
@media print { .page-progress { display: none !important; } }

.flash-stack {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: min(36rem, calc(100vw - 2rem));
  pointer-events: none;
}
.flash-toast {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.68rem 1rem;
  border-radius: 10px;
  background: #e6f4ea;
  border: 1px solid #b7e1c1;
  color: #146c2e;
  font-size: 0.86rem;
  font-weight: 500;
  box-shadow: 0 6px 20px rgba(32, 33, 36, 0.14);
  animation: flash-in 0.18s ease-out;
}
.flash-toast.is-out { opacity: 0; transform: translateY(-6px); transition: opacity 0.3s ease, transform 0.3s ease; }
.flash-toast.is-bad {
  background: #fce8e6;
  border-color: #f3c2bd;
  color: #b3261e;
}
.flash-text { min-width: 0; }
.flash-toast.is-bad .flash-tick { background: var(--danger); }
.flash-tick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: #188038;
  color: #fff;
  font-size: 0.7rem;
  flex: 0 0 auto;
}
@keyframes flash-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
@media print {
  .flash-stack { display: none !important; }
}

/* —— Home dashboard —— */
.page-home .lead {
  margin: 0.35rem 0 0;
  max-width: 46rem;
  color: var(--text-muted);
}
.page-home .page-head { padding-right: 2.75rem; }
.head-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.quick-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1.35rem;
}
.quick-strip a {
  padding: 0.32rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none !important;
}
.quick-strip a:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  background: var(--accent-soft);
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 0.75rem;
  margin: 0 0 1.35rem;
}
.kpi {
  padding: 0.8rem 0.95rem;
  border-radius: var(--radius);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-top: 3px solid var(--accent-color);
  box-shadow: var(--shadow);
}
.kpi:nth-child(1) { border-top-color: #1a73e8; }
.kpi:nth-child(2) { border-top-color: #e37400; }
.kpi:nth-child(3) { border-top-color: #188038; }
.kpi:nth-child(4) { border-top-color: #12a4af; }
.kpi:nth-child(5) { border-top-color: #d93025; }
.kpi:nth-child(6) { border-top-color: #7b61ff; }
.kpi-grid-4 { grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr)); }
.kpi.accent-blue { border-top-color: #1a73e8; }
.kpi.accent-green { border-top-color: #188038; }
.kpi.accent-orange { border-top-color: #e37400; }
.kpi.accent-red { border-top-color: #d93025; }
.kpi.accent-teal { border-top-color: #12a4af; }
.kpi.accent-purple { border-top-color: #7b61ff; }
tr.has-balance td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.has-balance-amount { color: var(--danger); font-weight: 500; }
.kpi-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.kpi-value {
  display: block;
  margin: 0.18rem 0 0.12rem;
  font-size: 1.28rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.kpi-note { display: block; font-size: 0.72rem; color: var(--text-muted); }
.delta { font-weight: 700; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--text-muted); }
.dash-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  margin: 0 0 1.35rem;
}
.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}
.card-head h2 { margin: 0; }
.card-sub { font-size: 0.72rem; color: var(--text-muted); }
.card-foot {
  margin-top: 0.75rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.78rem;
}
.small { font-size: 0.75rem; }
.checks-panel .card-head { padding: 0.9rem 1.1rem 0.1rem; }
.checks-panel .card-foot { margin: 0; padding: 0.6rem 1.1rem 0.8rem; }
.chart-legend {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.35rem;
  font-size: 0.74rem;
  color: var(--text-muted);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.dot { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 2px; }
.dot-sales { background: #1a73e8; }
.dot-coll { background: #188038; }
.dot-exp { background: #e37400; }
.dot-pay { background: #7b61ff; }
.chart { position: relative; height: 190px; margin: 0.25rem 0 0.1rem; }
.chart-grid {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 1.35rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.chart-grid span { border-top: 1px dashed #e8eaed; }
.chart-cols { position: relative; display: flex; gap: 0.35rem; height: 100%; }
.chart-group { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.chart-bars {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
}
.chart-bars .bar { width: 16px; max-width: 26%; min-height: 2px; border-radius: 3px 3px 0 0; }
.bar-sales { background: #1a73e8; }
.bar-coll { background: #188038; }
.bar-exp { background: #e37400; }
.bar-pay { background: #7b61ff; }
.chart-label { margin-top: 0.35rem; font-size: 0.7rem; color: var(--text-muted); }
.chart-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.35rem;
  font-size: 0.76rem;
  color: var(--text-muted);
}
.chart-foot b { color: var(--text-dark); font-weight: 500; }
.aging-list { display: flex; flex-direction: column; gap: 0.5rem; }
.aging-row {
  display: grid;
  grid-template-columns: 7.5rem 1fr auto;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
}
.aging-label { color: var(--text-muted); }
.aging-track { height: 0.6rem; border-radius: 999px; background: #f1f3f4; overflow: hidden; }
.aging-fill { display: block; height: 100%; min-width: 2px; border-radius: 999px; background: var(--accent-color); }
.aging-fill.tone-current { background: #188038; }
.aging-fill.tone-bucket_30 { background: #1a73e8; }
.aging-fill.tone-bucket_60 { background: #f9ab00; }
.aging-fill.tone-bucket_90 { background: #e37400; }
.aging-fill.tone-bucket_90p { background: #d93025; }
.aging-amount { white-space: nowrap; font-variant-numeric: tabular-nums; }
td.aging-late { color: var(--danger); font-weight: 500; }
.aging-table td, .aging-table th { white-space: nowrap; }
.aging-table td:first-child, .aging-table th:first-child { white-space: normal; }
.program-stats { display: flex; flex-wrap: wrap; gap: 1.2rem; margin: 0.1rem 0 0.6rem; }
.program-stats div { min-width: 7rem; }
.program-stats span {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.program-stats b { display: block; font-size: 1rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.progress { height: 0.55rem; border-radius: 999px; background: #f1f3f4; overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 999px; background: #188038; }
table.mini { margin-top: 0.2rem; }
table.mini td { padding: 0.3rem 0; border-bottom: 1px solid #f1f3f4; }
table.mini tr:last-child td { border-bottom: 0; }

@media print {
  .side, .search, .pager, .btn, button, .toolbar, .hist-back, .html-tip { display: none !important; }
  .app { display: block; }
  .workspace { padding: 0; max-width: none; }
}

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .side { position: relative; height: auto; }
  .side-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
  .nav-group-label { width: 100%; }
  .workspace { padding: 1rem; }
  .form-row { grid-template-columns: 1fr; }
}
