/* ==========================================================================
   Agile PMS — Solid Glass adaptation
   Visual layer only. No business logic or layout breakpoints are changed here.
   ========================================================================== */

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/geist-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/geist-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/geist-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/geist-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --sg-canvas: #eceeea;
  --sg-canvas-deep: #e3e6e0;
  --sg-panel: #f7f8f5;
  --sg-panel-strong: #f8f9f6;
  --sg-ink: #1b211e;
  --sg-ink-soft: #4f5a54;
  --sg-muted: #566159;
  --sg-faint: #5f6a63;
  --sg-line: rgba(27, 33, 30, 0.12);
  --sg-line-strong: rgba(27, 33, 30, 0.18);
  --sg-rim: rgba(255, 255, 255, 0.72);
  --sg-accent: #2f7a63;
  --sg-accent-strong: #25624f;
  --sg-accent-soft: #e4efe9;
  --sg-sidebar: #171b19;
  --sg-sidebar-2: #1e2320;
  --sg-sidebar-line: rgba(255, 255, 255, 0.08);
  --sg-sidebar-ink: #e6eae7;
  --sg-sidebar-muted: #8f9a93;
  --sg-shadow-card: inset 0 1px 0 var(--sg-rim), 0 1px 2px rgba(27, 33, 30, 0.04),
    0 18px 40px -32px rgba(27, 33, 30, 0.35);
  --sg-shadow-popover: inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 24px 64px -32px rgba(27, 33, 30, 0.5);
}

html {
  background: var(--sg-canvas);
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    sans-serif;
  background-color: var(--sg-canvas);
  color: var(--sg-ink);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(47, 122, 99, 0.22);
  color: var(--sg-ink);
}

body h1,
body h2,
body h3,
body h4 {
  font-weight: 600 !important;
  letter-spacing: -0.02em;
}

body .font-black {
  font-weight: 600 !important;
}

/* Tone down the repeated micro-label / all-caps treatment. */
body [class*="uppercase"][class*="tracking"] {
  text-transform: none !important;
  letter-spacing: 0.03em !important;
}

body [class*="tracking-[0.2em]"],
body [class*="tracking-[0.18em]"],
body [class*="tracking-[0.16em]"],
body [class*="tracking-[0.12em]"] {
  letter-spacing: 0.035em !important;
}

body [class*="text-[10px]"] {
  font-size: 0.6875rem !important;
}

body [class*="text-[9px]"] {
  font-size: 0.625rem !important;
}

/* Neutralise the old coloured shadows; depth should come from the rim. */
body [class*="shadow-indigo"] {
  --tw-shadow-color: rgba(27, 33, 30, 0.16) !important;
}

body .bg-indigo-500,
body .bg-indigo-600 {
  background-color: var(--sg-accent);
}

body .bg-indigo-500 {
  background-color: var(--sg-accent);
}

body .bg-indigo-600:hover {
  background-color: var(--sg-accent-strong);
}

body .rounded-2xl.bg-white,
body .rounded-3xl.bg-white {
  border-color: var(--sg-line);
  box-shadow: var(--sg-shadow-card);
}

body .rounded-3xl.bg-white {
  background-color: var(--sg-panel-strong);
}

body .rounded-2xl.border-dashed.bg-white,
body .rounded-2xl.border-dashed.bg-white\/60 {
  background-color: rgba(247, 248, 245, 0.7);
}

body thead tr[class] {
  text-transform: none !important;
  letter-spacing: 0.03em !important;
  font-weight: 600 !important;
  font-size: 0.6875rem !important;
}

body thead th {
  font-weight: 600;
  color: var(--sg-muted);
}

body table td {
  color: var(--sg-ink-soft);
}

body table td .text-slate-900,
body table td .text-slate-800,
body table td .text-slate-700 {
  color: var(--sg-ink);
}

/* ==========================================================================
   Shell
   ========================================================================== */

body .sg-shell {
  background: var(--sg-canvas);
}

body .sg-topbar {
  background: rgba(236, 238, 234, 0.82);
  border-bottom: 1px solid var(--sg-line);
  backdrop-filter: blur(18px) saturate(0.9);
}

body .sg-sidebar {
  background: var(--sg-sidebar);
  color: var(--sg-sidebar-ink);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

body .sg-sidebar-section {
  color: #8f9a93;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

body .sg-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 10px;
  padding: 0.625rem 0.75rem;
  color: var(--sg-sidebar-muted);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

body .sg-sidebar-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--sg-sidebar-ink);
}

body .sg-sidebar-link.is-active {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  box-shadow: inset 2px 0 0 var(--sg-accent),
    inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 1px 0 rgba(0, 0, 0, 0.18);
}

body .sg-sidebar-link svg {
  width: 1.125rem;
  height: 1.125rem;
  stroke-width: 1.7;
}

body .sg-brand-mark {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 auto;
  border-radius: 10px;
  background: #202722;
  color: #dce8e1;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.18);
}

body .sg-brand-mark svg {
  width: 1.15rem;
  height: 1.15rem;
}

body .sg-sidebar-toggle svg {
  width: 1.125rem;
  height: 1.125rem;
  transition: transform 180ms ease;
}

html.sg-sidebar-hidden .sg-sidebar-toggle-chevron {
  transform: rotate(180deg);
}

body .sg-sidebar-wrap {
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 220ms;
  will-change: transform;
}

body .sg-sidebar-wrap.is-drawer-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 0s;
}

body .sg-drawer-overlay {
  z-index: 45;
}

@media (max-width: 1023px) {
  body.sg-drawer-open {
    overflow: hidden;
  }
}

@media (min-width: 1024px) {
  body .sg-sidebar-wrap {
    transform: none;
    visibility: visible;
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0s linear 0s;
  }

  body .sg-sidebar-wrap.is-drawer-open {
    transform: none;
    visibility: visible;
  }

  .sg-main-wrap {
    transition: padding-left 220ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  html.sg-sidebar-hidden .sg-sidebar-wrap {
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0s linear 220ms;
  }

  html.sg-sidebar-hidden .sg-main-wrap {
    padding-left: 0;
  }
}

body .sg-avatar {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  background: var(--sg-accent-soft);
  color: var(--sg-accent-strong);
  border: 1px solid var(--sg-line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  font-size: 0.875rem;
  font-weight: 600;
}

body .sg-popover {
  background: rgba(248, 249, 246, 0.92);
  border: 1px solid var(--sg-line);
  border-radius: 14px;
  box-shadow: var(--sg-shadow-popover);
  backdrop-filter: blur(18px) saturate(0.9);
}

/* ==========================================================================
   Surfaces and typography helpers
   ========================================================================== */

body .sg-panel,
body .sg-card {
  background: var(--sg-panel);
  border: 1px solid var(--sg-line);
  border-radius: 14px;
  box-shadow: var(--sg-shadow-card);
}

body .sg-panel.border-dashed {
  border-style: dashed;
}

body .sg-panel-flat {
  background: var(--sg-panel);
  border: 1px solid var(--sg-line);
  border-radius: 14px;
}

body .sg-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--sg-accent-strong);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

body .sg-eyebrow.is-warning {
  color: #7f5323;
}

body .sg-login-aside .sg-eyebrow {
  color: #8cbea9;
}

body .sg-page-title {
  margin-top: 0.5rem;
  color: var(--sg-ink);
  font-size: clamp(1.5rem, 2.2vw, 1.875rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

body .sg-page-description {
  margin-top: 0.35rem;
  max-width: 48rem;
  color: var(--sg-muted);
  font-size: 0.875rem;
  line-height: 1.6;
}

body .grid.h-10.w-10.rounded-xl,
body .grid.h-9.w-9.rounded-full:not(.bg-white\/10),
body .grid.h-12.w-12.rounded-2xl {
  background: rgba(248, 249, 246, 0.72);
  border: 1px solid var(--sg-line);
  box-shadow: inset 0 1px 0 var(--sg-rim);
}

body .sg-metric-label {
  color: var(--sg-muted);
  font-size: 0.75rem;
  font-weight: 500;
}

body .sg-metric-value {
  color: var(--sg-ink);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

body .sg-divider {
  border-color: var(--sg-line);
}

body label > span[class] {
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* HTMX indicators stay out of the document flow until a request starts. */
body .htmx-indicator {
  display: none;
}

body .htmx-request .htmx-indicator,
body .htmx-request.htmx-indicator {
  display: flex;
}

/* ==========================================================================
   Controls
   ========================================================================== */

body .sg-btn-primary,
body .sg-btn-secondary,
body .sg-btn-danger,
body .sg-btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.625rem 1rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
  transition: background-color 150ms ease, border-color 150ms ease,
    box-shadow 150ms ease, color 150ms ease;
}

body .sg-btn-primary {
  background: var(--sg-accent);
  color: #f8fbf9;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 1px 2px rgba(27, 33, 30, 0.12);
}

body .sg-btn-primary:hover {
  background: var(--sg-accent-strong);
}

body .sg-btn-primary:focus-visible,
body .sg-btn-secondary:focus-visible,
body .sg-btn-danger:focus-visible,
body .sg-btn-ghost:focus-visible {
  outline: 2px solid var(--sg-accent);
  outline-offset: 2px;
}

body .sg-btn-secondary {
  background: rgba(248, 249, 246, 0.82);
  color: var(--sg-ink-soft);
  border: 1px solid var(--sg-line-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 1px 2px rgba(27, 33, 30, 0.05);
}

body .sg-btn-secondary:hover {
  background: #ffffff;
  color: var(--sg-ink);
}

body .sg-btn-danger {
  background: #9b4141;
  color: #fff7f7;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 1px 2px rgba(27, 33, 30, 0.12);
}

body .sg-btn-danger:hover {
  background: #813838;
}

body .sg-btn-ghost {
  background: transparent;
  color: var(--sg-muted);
  border: 1px solid transparent;
}

body .sg-btn-ghost:hover {
  background: rgba(27, 33, 30, 0.05);
  color: var(--sg-ink);
}

/* Header statistic chips match the height and typography of button controls. */
body .sg-stat-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.625rem;
  padding: 0.625rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
  white-space: nowrap;
  flex-shrink: 0;
}

body .sg-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  color: var(--sg-muted);
  transition: background-color 150ms ease, color 150ms ease;
}

body .sg-icon-btn:hover {
  background: rgba(27, 33, 30, 0.06);
  color: var(--sg-ink);
}

body .sg-sidebar-toggle:focus-visible {
  outline: 2px solid var(--sg-accent);
  outline-offset: 2px;
}

body .sg-field {
  width: 100%;
  min-height: 2.625rem;
  border: 1px solid var(--sg-line-strong);
  border-radius: 10px;
  background: var(--sg-panel-strong);
  padding: 0.625rem 0.75rem;
  color: var(--sg-ink);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: inset 0 1px 2px rgba(27, 33, 30, 0.03);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

body .sg-field::placeholder {
  color: var(--sg-faint);
}

body .sg-field:focus {
  border-color: var(--sg-accent);
  box-shadow: 0 0 0 3px rgba(47, 122, 99, 0.14);
}

body .sg-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 1.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  background: rgba(248, 249, 246, 0.72);
  border: 1px solid var(--sg-line);
  color: var(--sg-muted);
  font-size: 0.6875rem;
  font-weight: 600;
}

body .sg-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.25;
  border: 1px solid transparent;
}

/* ==========================================================================
   Tables
   ========================================================================== */

body .sg-table-shell {
  overflow: hidden;
  border: 1px solid var(--sg-line);
  border-radius: 14px;
  background: var(--sg-panel);
  box-shadow: var(--sg-shadow-card);
}

body .sg-table-shell table {
  border-collapse: separate;
  border-spacing: 0;
}

body .sg-table-shell thead {
  background: rgba(236, 238, 234, 0.72);
}

body .sg-table-shell tbody tr {
  transition: background-color 150ms ease;
}

body .sg-table-shell tbody tr:hover {
  background: rgba(236, 238, 234, 0.52);
}

body .sg-sticky-col {
  background: var(--sg-panel-strong) !important;
  background-clip: padding-box;
}

body .sg-sticky-col::after {
  content: "";
  position: absolute;
  inset-block: 0;
  right: -1px;
  width: 1px;
  background: var(--sg-line);
}

body .sg-progress {
  height: 0.5rem;
  overflow: hidden;
  border-radius: 9999px;
  background: var(--sg-canvas-deep);
  box-shadow: inset 0 1px 2px rgba(27, 33, 30, 0.06);
}

body .sg-progress > span,
body .sg-progress > div {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--sg-accent);
}

/* ==========================================================================
   Modal / popover
   ========================================================================== */

body .sg-modal-backdrop {
  background: rgba(23, 27, 25, 0.52);
  backdrop-filter: blur(6px);
}

body .sg-modal {
  background: var(--sg-panel-strong);
  border: 1px solid var(--sg-line);
  border-radius: 18px;
  box-shadow: var(--sg-shadow-popover);
}

body .sg-modal-header {
  background: rgba(247, 248, 245, 0.82);
  border-bottom: 1px solid var(--sg-line);
}

body .sg-modal-footer {
  background: rgba(247, 248, 245, 0.7);
  border-top: 1px solid var(--sg-line);
}

body .sg-toast {
  background: rgba(248, 249, 246, 0.94);
  border: 1px solid var(--sg-line);
  border-radius: 12px;
  box-shadow: var(--sg-shadow-popover);
  backdrop-filter: blur(18px) saturate(0.9);
}

body .sg-toast-icon {
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  flex: 0 0 auto;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ==========================================================================
   Login
   ========================================================================== */

body .sg-login-aside {
  position: relative;
  overflow: hidden;
  background-color: var(--sg-sidebar);
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

body .sg-login-aside::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 18% 18%, rgba(47, 122, 99, 0.16), transparent 42%);
}

body .sg-login-panel {
  background: var(--sg-panel-strong);
  border: 1px solid var(--sg-line);
  border-radius: 18px;
  box-shadow: var(--sg-shadow-popover);
}

body .sg-login-copy {
  position: relative;
  z-index: 1;
}

body .sg-login-metric {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ==========================================================================
   Small responsive refinements
   ========================================================================== */

@media (max-width: 767px) {
  body .sg-table-shell {
    border-radius: 12px;
  }

  body .sg-modal {
    border-radius: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body .sg-sidebar-link,
  body .sg-btn-primary,
  body .sg-btn-secondary,
  body .sg-btn-danger,
  body .sg-btn-ghost,
  body .sg-field,
  body .sg-sidebar-wrap,
  body .sg-sidebar-wrap.is-drawer-open,
  body .sg-main-wrap,
  body .sg-sidebar-toggle svg {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }

  html.sg-sidebar-hidden .sg-sidebar-wrap {
    transition-delay: 0s !important;
  }
}
