/* PSK Business ERP — application shell: sidebar, top bar, page */
.app { display: flex; height: 100vh; height: 100dvh; }

/* ---------- sidebar ---------- */
.sidebar {
  width: var(--sidebar-w); flex: none; display: flex; flex-direction: column; z-index: 60;
  background: linear-gradient(180deg, #16365F 0%, #112B4D 100%); color: #C9D6EA;
  transition: width .22s var(--ease), transform .25s var(--ease);
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; height: var(--topbar-h); padding: 0 16px; border-bottom: 1px solid rgba(255, 255, 255, .07); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; white-space: nowrap; }
.brand-text strong { color: #fff; font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.brand-text small { color: #8FA5C6; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; }
.sidebar .sidebar-close { display: none; margin-left: auto; color: #C9D6EA; }
.nav { flex: 1; overflow-y: auto; padding: 10px 12px 12px; scrollbar-color: rgba(255, 255, 255, .18) transparent; }
.nav-group + .nav-group { margin-top: 10px; }
.nav-label { font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: #6F87AB; padding: 8px 10px 4px; white-space: nowrap; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; margin: 1px 0; border: 0; border-radius: 9px;
  background: transparent; color: #C4D2E8; font-size: 13.5px; font-weight: 500; white-space: nowrap; text-align: left;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav-item .icon { opacity: .85; }
.nav-item.active { background: rgba(255, 255, 255, .12); color: #fff; font-weight: 600; }
.nav-item.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-item.active .icon { opacity: 1; color: #fff; }
.sidebar-foot { padding: 10px 12px 14px; border-top: 1px solid rgba(255, 255, 255, .07); flex: none; }
.tour-link { background: rgba(245, 158, 11, .12); color: #FCD9A0; }
.tour-link:hover { background: rgba(245, 158, 11, .2); color: #FFE7BF; }
.powered { margin-top: 10px; padding: 0 10px; font-size: 11.5px; color: #7F95B8; white-space: nowrap; overflow: hidden; }
.powered strong { color: #DCE6F5; font-weight: 600; }
.sidebar-scrim { display: none; }

body.nav-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.nav-collapsed .brand-text, body.nav-collapsed .nav-item span, body.nav-collapsed .powered, body.nav-collapsed .nav-label { display: none; }
body.nav-collapsed .nav-group + .nav-group { border-top: 1px solid rgba(255, 255, 255, .07); padding-top: 8px; }
body.nav-collapsed .nav-item { justify-content: center; padding: 11px 0; }
body.nav-collapsed .sidebar-brand { justify-content: center; padding: 0; }
body.nav-collapsed .nav-item.active::before { left: -12px; }

/* ---------- main / top bar ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 14px; padding: 0 22px 0 14px;
  background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); z-index: 40;
}
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; min-width: 0; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--text); text-decoration: none; }
.breadcrumb span:last-child { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb .icon { color: #B6C0D2; }
.search { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
.search input {
  width: 100%; height: 38px; padding: 0 44px 0 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search input::placeholder { color: #9AA5B8; }
.search input:focus { border-color: var(--secondary); background: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.search input::-webkit-search-cancel-button { display: none; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #9AA5B8; display: flex; pointer-events: none; }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.search input:focus ~ kbd { display: none; }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; max-height: min(70vh, 520px); overflow: auto; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 80; animation: pop .14s var(--ease);
}
.search-group { display: flex; justify-content: space-between; padding: 8px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.search-group em { font-style: normal; font-weight: 500; }
.search-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.search-item:hover, .search-item.on { background: var(--blue-50); text-decoration: none; }
.search-item .icon { color: var(--secondary); }
.search-item span { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.search-item b { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-hint { padding: 14px 12px; color: var(--muted); font-size: 13px; }
.search-hint b { color: var(--text-2); }
.topbar-right { display: flex; align-items: center; gap: 10px; flex: none; }
.today { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); font-weight: 500; padding: 0 6px; white-space: nowrap; }
.today .icon { color: var(--muted); }
.profile { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border: 1px solid transparent; border-radius: 10px; background: transparent; transition: background .15s, border-color .15s; }
.profile:hover { background: var(--surface-2); border-color: var(--line); }
.profile-text { display: flex; flex-direction: column; text-align: left; line-height: 1.25; }
.profile-text b { font-size: 13px; font-weight: 600; white-space: nowrap; }
.profile-text small { font-size: 11.5px; color: var(--secondary); font-weight: 600; white-space: nowrap; }
.profile > .icon { color: var(--muted); }

/* ---------- page ---------- */
.page { flex: 1; overflow-y: auto; overflow-x: hidden; outline: none; scroll-behavior: smooth; }
.page-inner { max-width: 1480px; margin: 0 auto; padding: 24px 28px 48px; }
.page-inner.enter { animation: rise .28s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.985); } to { opacity: 1; transform: none; } }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title p { color: var(--muted); margin-top: 4px; font-size: 13.5px; max-width: 720px; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-body > * + * { margin-top: 20px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.section-title h2 { font-size: 16px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 500; margin-bottom: 12px; }
.back-link:hover { color: var(--text); text-decoration: none; }
