/* NOTE: @import statements deliberately removed.
   Order is controlled by Layout::GetMainStylesheet() because
   Template::CompileStylesheet does not process @import statements
   (they would survive into the cached bundle and trigger broken
   runtime fetches against the static asset host). */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-primary);
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Material Icons — overflow:hidden clips ligature text before the font loads (FOUT protection). */
.sym {
    font-family: 'Material Symbols Outlined', sans-serif;
    font-weight: var(--icon-weight);
    font-style: normal;
    font-size: var(--icon-size-md);
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: 'liga';
}

/* Filled variant — for state icons whose legacy sprite had an outline/filled pair
   (e.g. linked documents). JS toggles the class, the glyph name stays the same. */
.sym--filled {
    font-variation-settings: 'FILL' 1;
}

/* Status variants — for a state icon that was one sprite shape in several hard-coded colours
   (`icon-file_debt_accepted/rejected/pending` were the same document path with fill #97D065 /
   #EB3E53 / #F2BD48). A Material Symbol takes its colour from CSS, so the backend now emits the
   modifier and the glyph name is fixed in the template. Dark theme is covered: --color-* remap. */
.sym--success { color: var(--color-success); }
.sym--warning { color: var(--color-warning); }
.sym--error   { color: var(--color-error); }

.sym > .custom_tooltip {
    font-family: var(--font-family-primary);
    font-size: 13px;
    font-weight: normal;
    font-style: normal;
    line-height: 18px;
    letter-spacing: normal;
    white-space: normal;
    display: none;
}

/* A .sym is 16-20px with overflow:hidden, so a tooltip appended inside one is clipped to the
   glyph box. custom_tooltip.js puts .custom_tooltip_container on whatever element it was given,
   which is the icon itself wherever the icon carries the id. */
.sym.custom_tooltip_container {
    overflow: visible;
}

/* Anchor it under the icon and let it grow rightwards. The legacy rule is right-aligned to its
   container with a fixed bottom offset, which on a 16px icon at the end of a label threw the box
   300px to the left, over the field it explains. */
.sym.custom_tooltip_container > .custom_tooltip {
    left: 0;
    right: auto;
    bottom: auto;
    top: calc(100% + var(--spacing-xs));
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-primary);
}

.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Layout: integrate .app-nav sidebar into the existing #container shell.
   The legacy #container is a single column; turning it into a flex row
   lets the sidebar sit next to #main without overlay/absolute hacks.
   Reset legacy margin (70px top + auto sides + 3rem bottom) that existed
   to clear the old fixed-position header. */
#container.container {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    margin: 0;
    min-height: 100vh;
    padding-bottom: 0;
}

.app-nav {
    flex: 0 0 auto;
}

#main.main-sidebar {
    flex: 1 1 0;
    min-width: 0;
	padding-right: 3rem;
	/* Anchor for .app-spinner-overlay--contained, which common_header.htm renders
	   on load and showPageSpinner() appends on demand. */
	position: relative;
}

@media (max-width: 1200px) {
	#main.main-sidebar {
		padding-right: var(--spacing-xl);
	}
}

@media (max-width: 1024px) {
	#main.main-sidebar {
		padding-left: var(--spacing-lg);
		padding-right: var(--spacing-lg);
	}
}
