/* AST workspace shell. Brand palette: aiservicetrans.kz, 21.09.2026. */
:root {
  --bg: #f4f5f7;
  --navy: #111722;
  --navy-dark: #070814;
  --navy-soft: #eef1f5;
  --orange: #fd7801;
  --orange-dark: #cf4e17;
  --border: #e7e9ee;
  --border-strong: #d5dae2;
  --text-muted: #576171;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-sm: 8px;
  --sidebar-width: 248px;
  --app-header-height: 68px;
}
body { font-size: 15px; }
button, input, select, textarea { font-family: inherit; }
button, a, input, select, textarea { touch-action: manipulation; }
.skip-link { position: fixed; top: -100px; left: 12px; z-index: 1600; padding: 10px 16px; border-radius: 8px; background: white; color: var(--navy); }
.skip-link:focus { top: 12px; }
.app-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; display: flex; flex-direction: column; width: var(--sidebar-width); height: 100dvh; padding: 20px 12px 12px; background: #111722; color: #e9edf4; overflow-y: auto; overscroll-behavior: contain; }
.app-sidebar-brand { display: flex; align-items: center; justify-content: space-between; margin: 0 4px 30px; min-height: 64px; }
.app-logo { display: flex; align-items: center; justify-content: center; width: 192px; max-width: 100%; min-height: 66px; padding: 6px 10px; border-radius: 10px; background: #fff; }
.app-logo img { display: block; width: 100%; height: auto; }
.app-sidebar-close { display: none; color: #e9edf4; }
.app-nav { display: flex; flex-direction: column; gap: 6px; }
.app-nav-link, .app-logout { display: flex; align-items: center; gap: 12px; min-height: 46px; width: 100%; padding: 11px 12px; border: 1px solid transparent; border-radius: 8px; color: #c4cdda; background: transparent; font-size: .9rem; font-weight: 550; line-height: 1.4; text-decoration: none; text-align: left; cursor: pointer; }
.app-nav-link svg, .app-logout svg { flex: 0 0 20px; }
.app-nav-link:hover, .app-logout:hover { background: #202a39; color: white; }
.app-nav-link.active { background: #fd7801; color: #111722; font-weight: 700; }
.app-nav-label { overflow-wrap: anywhere; }
.app-profile { margin-top: auto; padding-top: 24px; }
.app-profile-link { display: flex; align-items: center; gap: 10px; min-height: 62px; padding: 10px 6px; border-top: 1px solid #303a49; text-decoration: none; border-radius: 6px; }
.app-profile-link:hover, .app-profile-link[aria-current=page] { background: #202a39; }
.app-avatar { display: flex; align-items: center; justify-content: center; flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%; color: #111722; background: #ffe2c7; font-size: .78rem; font-weight: 750; }
.app-profile-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.app-profile-copy strong { overflow-wrap: anywhere; font-size: .82rem; line-height: 1.35; font-weight: 600; }
.app-profile-copy > span { color: #aeb9ca; font-size: .74rem; }
.app-profile form { margin: 4px 0 0; }
.app-workspace { position: relative; isolation: isolate; min-width: 0; min-height: 100vh; margin-left: var(--sidebar-width); background: var(--bg); }
.app-header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 12px 28px; border-bottom: 1px solid var(--border); background: var(--surface); }
.app-home { display: inline-flex; align-items: center; gap: 16px; min-width: 0; text-decoration: none; color: var(--navy); font-size: .94rem; font-weight: 650; }
.app-home img { object-fit: contain; flex-shrink: 0; }
.app-menu-toggle { color: var(--navy); border: 1px solid var(--border-strong); }
.app-workspace > .shell { position: relative; z-index: 1; padding: 28px 24px 40px; }
.workspace-surface { min-width: 0; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: 0 3px 12px rgb(17 23 34 / 3%); }
.workspace-surface:focus { outline: none; }
.workspace-surface:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
.workspace-watermark { position: fixed; z-index: 0; right: 20px; bottom: 20px; width: clamp(240px, 26vw, 420px); max-width: calc(100vw - var(--sidebar-width) - 40px); pointer-events: none; user-select: none; opacity: .75; }
.workspace-watermark img { display: block; width: 100%; height: auto; }
/* Shared surfaces stay opaque: watermark never competes with working data. */
.workspace-surface .page-head, .workspace-surface .work-heading { background: var(--surface); }
.workspace-surface h1, .workspace-surface .work-heading h1 { font-size: clamp(1.4rem, 2vw, 1.85rem); line-height: 1.25; letter-spacing: -.025em; overflow-wrap: anywhere; }
.workspace-surface h2 { line-height: 1.35; }
.workspace-surface .page-head, .workspace-surface .work-heading { margin-bottom: 20px; }
.workspace-surface .card { box-shadow: none; }
.workspace-surface :is(.btn-primary, .btn-secondary, .btn-danger) { min-height: 42px; border-radius: var(--radius-sm); box-shadow: none; }
.workspace-surface :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]), select) { min-height: 42px; max-width: 100%; }
.workspace-surface .pill { line-height: 1.45; }
.workspace-surface :is(.table-wrap, .data-table-scroll, .table-scroll) { max-width: 100%; }
.workspace-surface :is(.page-head, .work-heading) > * { min-width: 0; }
.app-backdrop[hidden] { display: none; }
.app-workspace--guest { margin-left: 0; }
.app-workspace--guest > .shell { max-width: 640px; }
.app-workspace--guest .workspace-surface { padding: 0; }
.app-workspace--guest .auth-card { margin: 0; max-width: none; border: 0; }
.app-workspace--guest .workspace-watermark { max-width: calc(100vw - 40px); }
@media (min-width: 1101px) {
  html[data-sidebar=collapsed] { --sidebar-width: 72px; }
  html[data-sidebar=collapsed] .app-sidebar { padding-inline: 8px; }
  html[data-sidebar=collapsed] .app-sidebar-brand { margin-inline: 0; }
  html[data-sidebar=collapsed] .app-logo { min-height: 40px; padding: 4px; }
  html[data-sidebar=collapsed] .app-nav-link, html[data-sidebar=collapsed] .app-logout { justify-content: center; padding-inline: 8px; }
  html[data-sidebar=collapsed] .app-nav-label, html[data-sidebar=collapsed] .app-profile-copy { display: none; }
  html[data-sidebar=collapsed] .app-profile-link { justify-content: center; padding-inline: 0; }
}
@media (max-width: 1100px) {
  .app-workspace { margin-left: 0; }
  .app-sidebar { visibility: hidden; transform: translateX(-100%); width: min(288px, calc(100vw - 56px)); z-index: 1500; }
  .app-sidebar[data-open] { visibility: visible; transform: none; }
  .app-sidebar-close { display: inline-flex; }
  .app-sidebar-brand { gap: 8px; }
  .app-logo { width: 170px; }
  .app-backdrop { position: fixed; inset: 0; z-index: 1499; background: rgb(7 8 20 / 45%); }
  body.app-menu-open { overflow: hidden; }
  .workspace-watermark { max-width: calc(100vw - 40px); }
}
@media (max-width: 640px) {
  .app-header { min-height: 64px; padding: 10px 14px; }
  .app-home { font-size: .85rem; }
  .app-workspace > .shell { padding: 16px 10px 28px; }
  .workspace-surface { padding: 16px 12px; }
  .workspace-surface .work-heading { flex-wrap: wrap; gap: 12px; }
  .workspace-surface .card { padding: 16px; }
  .workspace-watermark { right: 16px; bottom: 16px; width: 250px; }
}
@media (prefers-reduced-motion: no-preference) {
  .app-sidebar { transition: transform 160ms ease; }
}
/* The supplied logo includes a white canvas; blend only that decorative layer. */
.workspace-watermark { mix-blend-mode: multiply; }
.app-profile-copy strong { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Keep navigation reachable without covering the existing engineering toolbars. */
html { scroll-padding-top: calc(var(--app-header-height) + 16px); }
.app-workspace .bom-toolbar { top: var(--app-header-height); }
.app-workspace .equipment-documents-sidebar { top: calc(var(--app-header-height) + 18px); }

/* Shared own-profile avatar: decorative, never stretches the navigation. */
.app-avatar { overflow: hidden; }
.app-avatar img { width: 100%; height: 100%; object-fit: cover; }
.app-avatar [hidden] { display: none !important; }

/* Shared table pagination; the form owns page size even outside its DOM subtree. */
.workspace-page-size { display:flex; align-items:center; gap:8px; font-size:.85rem; color:var(--text-muted); }
.workspace-page-size select { width:76px; min-height:42px; padding:9px 10px; border:1px solid var(--border-strong); border-radius:var(--radius-sm); background:var(--surface); color:var(--text); font:inherit; }
.workspace-pagination { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:14px; padding-top:18px; color:var(--text-muted); font-size:.9rem; }
.workspace-pagination > div { display:flex; align-items:center; flex-wrap:wrap; gap:12px; }
.workspace-pagination .btn-secondary { min-width:42px; padding-inline:12px; }
