:root {
  color-scheme: light;
  --iw-ink: #101216;
  --iw-ink-soft: #252932;
  --iw-surface: #ffffff;
  --iw-canvas: #f4f6f8;
  --iw-line: #e5e8ed;
  --iw-muted: #65707d;
  --iw-blue: #3d69e8;
  --iw-green: #17865c;
  --iw-red: #d9414d;
  --iw-yellow: #f0b93b;
  --iw-radius: 1rem;
}

* {
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--iw-canvas);
  color: var(--iw-ink-soft);
  font-family: "DM Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  text-rendering: optimizeLegibility;
}

button, a, input, select, textarea {
  touch-action: manipulation;
}

a, button {
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease,
              box-shadow 150ms ease, transform 150ms ease;
}

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgb(61 105 232 / 48%);
  outline-offset: 2px;
}

::selection {
  background: rgb(61 105 232 / 16%);
}

.enterprise-layout {
  min-height: 100svh;
  background: var(--iw-canvas);
}

#sidebar {
  position: sticky;
  top: 0;
  width: 17rem;
  height: 100svh;
  flex: 0 0 17rem;
  align-self: flex-start;
  overflow: hidden;
  transition: width 220ms ease, flex-basis 220ms ease, transform 220ms ease;
  color: #f2f4f8;
  background:
    radial-gradient(ellipse 155px 240px at -8% 16%, rgb(61 105 232 / 15%), transparent 80%),
    linear-gradient(178deg, #101216 0%, #0a0b0f 75%, #131720 100%);
  border-right: 1px solid rgb(255 255 255 / 6%);
  box-shadow: 9px 0 30px rgb(16 18 22 / 4%);
}

.sidebar-collapse-toggle {
  display: none;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  color: #bfc6d2;
  background: rgb(255 255 255 / 5%);
  border: 1px solid rgb(255 255 255 / 9%);
  border-radius: .65rem;
  cursor: pointer;
}

.sidebar-collapse-toggle:hover {
  color: #fff;
  background: rgb(255 255 255 / 11%);
}

.sidebar-collapse-toggle svg {
  transition: transform 180ms ease;
}

#sidebar > div:first-child {
  min-height: 76px;
  padding-inline: 1.35rem;
  border-bottom-color: rgb(255 255 255 / 8%) !important;
}

#sidebar > div:nth-child(2) {
  padding: 1rem 1.35rem;
  border-bottom-color: rgb(255 255 255 / 8%) !important;
}

.nav-section {
  padding: 1.15rem 1.25rem .45rem;
  color: #808795;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .12em;
}

.nav-sub-hint {
  color: #858c98;
  font-size: .65rem;
  line-height: 1.55;
}

#sidebar nav a {
  position: relative;
  min-height: 42px;
  margin-inline: .65rem;
  padding-inline: .8rem;
  color: #bdc3ce;
  border-radius: .75rem;
  font-size: .84rem;
}

#sidebar nav a svg {
  color: var(--nav-accent, #a2a9b5);
  opacity: .88;
}

#sidebar nav a[href^="/invoices"] { --nav-accent: #81a1ff; }
#sidebar nav a[href^="/pos"] { --nav-accent: #56c695; }
#sidebar nav a[href^="/purchase"],
#sidebar nav a[href^="/vendors"] { --nav-accent: #f0c661; }
#sidebar nav a[href^="/customers"] { --nav-accent: #ef7180; }
#sidebar nav a[href^="/item-master"] { --nav-accent: #56c695; }
#sidebar nav a[href^="/masters"] { --nav-accent: #81a1ff; }
#sidebar nav a[href^="/superadmin"] { --nav-accent: #ef7180; }

#sidebar nav a:hover {
  color: #ffffff;
  background: rgb(255 255 255 / 7%);
}

#sidebar nav a[class~="bg-white/15"] {
  color: #ffffff;
  background: color-mix(in srgb, var(--nav-accent, #7187eb) 16%, transparent);
  box-shadow: inset 2px 0 0 var(--nav-accent, #8298ff);
}

#sidebar nav a[class~="bg-white/15"] svg {
  opacity: 1;
}

.nav-flag {
  padding: .16rem .45rem;
  color: #95d6b4;
  background: rgb(23 134 92 / 15%);
  border: 1px solid rgb(86 198 149 / 15%);
  border-radius: 999px;
  font-weight: 600;
}

.nav-admin {
  color: #f2cd72;
  background: rgb(240 185 59 / 12%);
  border-radius: 999px;
}

#sidebar nav > div[class*="border-t"] {
  border-color: rgb(255 255 255 / 9%) !important;
}

#sidebar nav summary {
  list-style: none;
}

#sidebar nav summary::-webkit-details-marker {
  display: none;
}

.nav-disclosure {
  margin: .15rem .65rem;
}

.nav-disclosure-trigger {
  --nav-accent: #f0c661;
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 42px;
  padding: 0 .8rem;
  border-radius: .75rem;
  color: #bdc3ce;
  cursor: pointer;
  font-size: .84rem;
  font-weight: 500;
  transition: color 150ms ease, background-color 150ms ease;
}

.nav-disclosure-trigger:hover {
  color: #fff;
  background: rgb(255 255 255 / 7%);
}

.nav-disclosure-trigger.is-active {
  color: #fff;
  background: color-mix(in srgb, var(--nav-accent) 16%, transparent);
  box-shadow: inset 2px 0 0 var(--nav-accent);
}

.nav-disclosure-trigger > svg:first-child,
.nav-disclosure-trigger > span > svg:first-child {
  color: var(--nav-accent);
}

.nav-disclosure-trigger > span:first-child {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}

.nav-disclosure-trigger .nav-label {
  flex: 1;
}

.nav-disclosure[open] > .nav-disclosure-trigger .nav-chevron {
  transform: rotate(90deg);
}

.nav-chevron {
  transition: transform 150ms ease;
}

.nav-disclosure-panel {
  margin: .25rem 0 .35rem 1.15rem;
  padding: .15rem 0 .15rem .5rem;
  border-left: 1px solid rgb(255 255 255 / 12%);
}

.nav-disclosure--nested {
  margin: 0;
}

.nav-disclosure-trigger--nested {
  min-height: 38px;
  padding-left: .55rem;
  font-size: .8rem;
}

.nav-disclosure-trigger--nested > svg:first-child {
  --nav-accent: #81a1ff;
}

.nav-disclosure-panel--nested {
  margin: .1rem 0 .35rem .8rem;
  padding-left: .45rem;
}

.nav-settings-links {
  display: grid;
  gap: .1rem;
}

.nav-sub-link {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: .45rem .65rem;
  border-radius: .65rem;
  color: #bdc3ce;
  font-size: .8rem;
  transition: color 150ms ease, background-color 150ms ease;
}

.nav-sub-link:hover,
.nav-sub-link.is-current {
  color: #fff;
  background: rgb(255 255 255 / 8%);
}

.nav-sub-link.is-current {
  box-shadow: inset 2px 0 0 #81a1ff;
}

#sidebar > div:last-child {
  padding: .8rem .65rem max(.8rem, env(safe-area-inset-bottom));
  border-top-color: rgb(255 255 255 / 8%) !important;
}

#sidebar > div:last-child a {
  min-height: 43px;
  padding-inline: .8rem;
  border-radius: .75rem;
}

.enterprise-layout > div:last-child {
  min-width: 0;
  background: var(--iw-canvas);
}

.enterprise-layout header {
  min-height: 66px;
  padding: .75rem clamp(1rem, 2.5vw, 2.5rem);
  background: rgb(255 255 255 / 94%);
  border-bottom: 1px solid var(--iw-line);
  box-shadow: 0 2px 12px rgb(16 18 22 / 3%);
  backdrop-filter: blur(14px);
}

.enterprise-layout header h1 {
  color: var(--iw-ink);
  font-size: 1.04rem;
  font-weight: 700;
  letter-spacing: -.022em;
}

.enterprise-layout header button {
  min-width: 42px;
  min-height: 42px;
  border: 1px solid var(--iw-line);
  background: #fff;
}

.enterprise-layout header button:hover {
  background: #f6f8fb;
  border-color: #cbd3df;
}

.enterprise-layout > div:last-child > main {
  width: 100%;
  max-width: 1720px;
  margin-inline: auto;
  padding: clamp(1rem, 2.4vw, 2.25rem);
}

#flash-area {
  padding-inline: clamp(1rem, 2.4vw, 2.25rem);
  margin-inline: auto;
  max-width: 1720px;
}

#flash-area > div {
  border-radius: .9rem;
  box-shadow: 0 4px 16px rgb(16 18 22 / 3%);
}

main :is(h1, h2, h3) {
  color: var(--iw-ink-soft);
  letter-spacing: -.022em;
}

main :is(.bg-white.rounded-2xl, .bg-white.rounded-xl) {
  border-color: var(--iw-line) !important;
  box-shadow: 0 4px 18px rgb(16 18 22 / 4%);
}

main .shadow-sm {
  box-shadow: 0 4px 18px rgb(16 18 22 / 4%);
}

main .bg-brand-600 {
  background-color: var(--iw-blue);
  box-shadow: 0 2px 5px rgb(61 105 232 / 14%);
}

main .bg-brand-600:hover,
main .hover\:bg-brand-700:hover {
  background-color: #3159cf;
}

main :is(a, button).text-brand-600,
main .text-brand-700 {
  color: var(--iw-blue);
}

main .bg-green-500,
main .bg-green-600,
main .bg-green-700 {
  background-color: var(--iw-green);
}

main :is(.bg-green-50, .bg-green-100) {
  background-color: #edf8f2;
}

main :is(.text-green-600, .text-green-700, .text-green-800) {
  color: #13754f;
}

main :is(.bg-amber-100, .bg-yellow-100) {
  background-color: #fff7df;
}

main :is(.text-amber-700, .text-amber-800, .text-yellow-700, .text-yellow-800) {
  color: #916608;
}

main :is(.bg-red-500, .bg-red-600, .bg-red-700) {
  background-color: var(--iw-red);
}

main :is(.bg-red-50, .bg-red-100) {
  background-color: #fff0ef;
}

main :is(.text-red-600, .text-red-700, .text-red-800) {
  color: #b8323c;
}

main :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  min-height: 42px;
  color: var(--iw-ink);
  background-color: #fff;
  border-color: #d9dee6;
  border-radius: .75rem;
  font-family: inherit;
}

main textarea {
  min-height: 96px;
}

main :is(input, select, textarea)::placeholder {
  color: #8a93a0;
}

main :is(input, select, textarea):focus {
  border-color: var(--iw-blue);
  box-shadow: 0 0 0 3px rgb(61 105 232 / 13%);
  outline: none;
}

main label {
  color: #454e5c;
  font-weight: 550;
}

main table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}

main table thead {
  background: #f7f8fa;
}

main table thead th {
  color: #616a78;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .065em;
}

main table :is(th, td) {
  padding-block: .85rem;
}

main table tbody tr {
  transition: background-color 140ms ease;
}

main table tbody tr:hover {
  background: #f7f9fc;
}

main .overflow-x-auto {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

main .invoice-card {
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

#toast-container > div {
  pointer-events: auto;
  border-radius: .9rem;
  box-shadow: 0 10px 30px rgb(16 18 22 / 15%);
}

@media (min-width: 1024px) {
  #sidebar {
    flex-basis: 17rem;
  }

  .sidebar-collapse-toggle {
    display: inline-flex;
  }

  .enterprise-layout.sidebar-collapsed #sidebar {
    width: 5rem;
    flex-basis: 5rem;
  }

  .enterprise-layout.sidebar-collapsed #sidebar > div:first-child {
    justify-content: center;
    gap: .3rem;
    padding-inline: .3rem;
  }

  .enterprise-layout.sidebar-collapsed #sidebar > div:first-child > img {
    width: 2rem;
    max-width: 2rem;
    height: 2rem;
    object-fit: contain;
  }

  .enterprise-layout.sidebar-collapsed #sidebar > div:first-child .font-semibold {
    display: none;
  }

  .enterprise-layout.sidebar-collapsed #sidebar > div:nth-child(2),
  .enterprise-layout.sidebar-collapsed #sidebar nav .nav-section,
  .enterprise-layout.sidebar-collapsed #sidebar nav .nav-sub-hint,
  .enterprise-layout.sidebar-collapsed #sidebar nav .nav-admin,
  .enterprise-layout.sidebar-collapsed #sidebar nav .nav-flag,
  .enterprise-layout.sidebar-collapsed #sidebar nav > span[aria-disabled="true"] {
    display: none !important;
  }

  .enterprise-layout.sidebar-collapsed #sidebar nav a > span.flex {
    font-size: 0;
  }

  .enterprise-layout.sidebar-collapsed #sidebar nav details > :not(summary) {
    display: none !important;
  }

  .enterprise-layout.sidebar-collapsed #sidebar nav details > summary {
    justify-content: center;
    gap: 0;
    padding-inline: 0;
    font-size: 0;
  }

  .enterprise-layout.sidebar-collapsed #sidebar nav details > summary .nav-label,
  .enterprise-layout.sidebar-collapsed #sidebar nav details > summary .nav-chevron {
    display: none !important;
  }

  .enterprise-layout.sidebar-collapsed #sidebar nav details > summary > span:first-child {
    justify-content: center;
    gap: 0;
    font-size: 0;
  }

  .enterprise-layout.sidebar-collapsed #sidebar nav details > summary > svg:first-child,
  .enterprise-layout.sidebar-collapsed #sidebar nav details > summary > span:first-child svg {
    width: 1.15rem;
    height: 1.15rem;
    flex: 0 0 auto;
  }

  .enterprise-layout.sidebar-collapsed #sidebar nav a,
  .enterprise-layout.sidebar-collapsed #sidebar > div:last-child a {
    justify-content: center;
    gap: 0;
    padding-inline: 0;
    font-size: 0;
  }

  .enterprise-layout.sidebar-collapsed #sidebar nav a svg,
  .enterprise-layout.sidebar-collapsed #sidebar > div:last-child a svg {
    width: 1.15rem;
    height: 1.15rem;
    flex: 0 0 auto;
  }

  .enterprise-layout.sidebar-collapsed #sidebar nav > div[class*="border-t"] {
    margin-inline: .9rem;
  }

  .enterprise-layout.sidebar-collapsed .sidebar-collapse-toggle svg {
    transform: rotate(180deg);
  }
}

@media (max-width: 1023px) {
  .enterprise-layout {
    min-height: 100svh;
  }

  #sidebar {
    position: fixed;
    z-index: 40;
    top: 0;
    left: 0;
    width: min(84vw, 310px);
    height: 100dvh;
    box-shadow: 20px 0 56px rgb(0 0 0 / 28%);
    padding-bottom: env(safe-area-inset-bottom);
  }

  #sidebar-overlay {
    position: fixed;
    z-index: 35;
    inset: 0;
    background: rgb(11 13 18 / 58%);
    backdrop-filter: blur(2px);
  }

  .enterprise-layout > div:last-child > main {
    padding: 1.05rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
  }

  .enterprise-layout header {
    min-height: 62px;
    padding-inline: .75rem 1rem;
  }

  #flash-area {
    padding-inline: 1rem;
  }

  main .overflow-x-auto table {
    min-width: 680px;
  }
}

@media (max-width: 639px) {
  .enterprise-layout > div:last-child > main {
    padding: .9rem .75rem calc(1.1rem + env(safe-area-inset-bottom));
  }

  .enterprise-layout header {
    min-height: 58px;
    padding: .55rem .75rem;
    gap: .5rem;
  }

  .enterprise-layout header h1 {
    min-width: 0;
    font-size: .97rem;
  }

  .enterprise-layout header > div {
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .enterprise-layout header :is(a, button) {
    min-height: 40px;
    max-width: 100%;
    font-size: .78rem;
  }

  #flash-area {
    padding-inline: .75rem;
  }

  main .space-y-5 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media print {
  body, .enterprise-layout, .enterprise-layout > div:last-child > main {
    background: #fff !important;
  }

  #sidebar, #sidebar-overlay, .enterprise-layout header {
    display: none !important;
  }

  .enterprise-layout > div:last-child > main {
    padding: 0 !important;
    max-width: none;
  }
}
