/*
 * Capybara ERP — compact application shell + typography.
 * This layer intentionally loads after legacy app.css and normalizes the shell
 * without changing business markup/routes.
 */

html,
body {
  font-family: var(--ui-font);
  font-size: var(--ui-font-size);
  line-height: 1.35;
  color: var(--ui-text);
  background: var(--ui-page-bg);
}

body,
button,
input,
select,
textarea,
table {
  font-family: var(--ui-font);
}

button,
input,
select,
textarea {
  font-size: var(--ui-font-size);
}

.erp-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--ui-sidebar-width) minmax(0, 1fr);
}

.erp-sidebar {
  width: var(--ui-sidebar-width);
  min-width: var(--ui-sidebar-width);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
  padding: 12px 10px 10px;
  background: #202946;
}

.erp-sidebar-inner {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.erp-logo {
  flex: 0 0 auto;
  padding: 5px 8px 14px;
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: .04em;
}

.erp-nav-list {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
}

.erp-nav-link {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.2;
  color: rgba(255,255,255,.84);
}

.erp-nav-link:hover,
.erp-nav-link.active {
  color: #fff;
  background: rgba(255,255,255,.11);
}

.erp-nav-link.active {
  font-weight: 600;
  box-shadow: inset 2px 0 0 rgba(255,255,255,.78);
}

.erp-sidebar-footer {
  flex: 0 0 auto;
  margin-top: 8px;
  padding: 10px 8px 2px;
  border-top: 1px solid rgba(255,255,255,.13);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.erp-sidebar-user {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,.86);
}

.erp-sidebar-logout {
  min-height: 28px;
  height: 28px;
  padding: 3px 8px;
  border: 1px solid rgba(255,255,255,.20);
  border-radius: 5px;
  background: transparent;
  color: rgba(255,255,255,.82);
  cursor: pointer;
  font-size: 12px;
}

.erp-sidebar-logout:hover {
  color: #fff;
  background: rgba(255,255,255,.10);
}

.erp-workspace {
  min-width: 0;
  min-height: 100vh;
}

/* Legacy topbar is deliberately removed from desktop ERP shell. */
.topbar {
  display: none !important;
}

.erp-content {
  width: 100%;
  min-width: 0;
  padding: var(--ui-content-padding);
}

.page-header {
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
}

.page-title {
  margin: 0;
  font-size: var(--ui-font-size-title);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -.01em;
}

.page-subtitle,
.muted,
.form-section-note,
.empty-cell,
.empty-state {
  color: var(--ui-muted);
}

.workspace-tabs-root {
  background: #eef1f3;
}

.workspace-tabs-desktop {
  min-height: 34px;
}

.workspace-tab-main {
  padding-top: 7px;
  padding-bottom: 7px;
  font-size: 12px;
}

.workspace-tab-close {
  flex-basis: 26px;
  width: 26px;
}

@media (max-width: 800px) {
  .erp-layout {
    display: block;
  }

  .erp-sidebar {
    position: static;
    width: 100%;
    min-width: 0;
    height: auto;
    padding: 8px 10px;
    overflow: visible;
  }

  .erp-sidebar-inner {
    height: auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }

  .erp-logo {
    padding: 0 4px;
    font-size: 15px;
  }

  .erp-nav-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .erp-nav-list::-webkit-scrollbar {
    display: none;
  }

  .erp-nav-link {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 6px 8px;
    white-space: nowrap;
  }

  .erp-sidebar-footer {
    margin: 0;
    padding: 0;
    border: 0;
  }

  .erp-sidebar-user {
    display: none;
  }

  .erp-sidebar-logout {
    min-height: 30px;
    height: 30px;
  }

  .erp-content {
    padding: var(--ui-content-padding-mobile);
  }

  .page-header {
    margin-bottom: 8px;
  }

  .page-title {
    font-size: 16px;
  }
}
