/* ============================================================
   AstroDesk — Layout (shell, sidebar, topbar)
   ============================================================ */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px; flex: none; background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  transition: width .2s var(--ease); z-index: 50;
}
.sidebar[data-collapsed] { width: 74px; }

.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  border: none; background: transparent; color: var(--text-muted);
  font-weight: 600; font-size: 14px; padding: 10px 12px; border-radius: 10px;
  transition: all .14s var(--ease); text-align: left; line-height: 1;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item[data-on] { background: var(--accent-soft); color: var(--accent); }
.nav-item[data-on] svg { stroke-width: 2.2; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 64px; padding: 0 24px; background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
.topbar-search {
  display: flex; align-items: center; gap: 9px; width: min(420px, 42vw);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-pill);
  padding: 0 13px; height: 40px; transition: all .15s;
}
.topbar-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3.5px var(--accent-soft); background: var(--surface); }
.topbar-search input { flex: 1; border: none; background: transparent; outline: none; font-size: 13.5px; color: var(--text); min-width: 0; }
.topbar-search input::placeholder { color: var(--text-faint); }
.topbar-menu { display: none; }
.topbar-div { width: 1px; height: 26px; background: var(--border); }

.role-btn {
  display: flex; align-items: center; gap: 9px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 5px 10px 5px 6px;
  transition: all .15s;
}
.role-btn:hover { border-color: var(--border-strong); }

.popover {
  position: absolute; top: calc(100% + 8px); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  padding: 8px; z-index: 60; animation: scaleIn .16s var(--ease);
}
.pop-item {
  display: flex; align-items: center; gap: 11px; width: 100%; border: none;
  background: transparent; padding: 9px 9px; border-radius: 10px; transition: background .12s;
  color: var(--text);
}
.pop-item:hover { background: var(--surface-3); }
.pop-item[data-on] { background: var(--accent-softer); }

.content { flex: 1; padding: 28px clamp(16px, 3vw, 36px); max-width: 1480px; width: 100%; margin: 0 auto; }
.content > * { animation: floatUp .3s var(--ease); }

/* grids */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.split-2col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

@media (max-width: 1080px) {
  .split-2col { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar[data-mobileopen] { transform: none; }
  .sidebar[data-collapsed] { width: 248px; }
  .topbar-menu { display: inline-flex; }
}
@media (max-width: 680px) {
  .topbar-search { width: auto; }
  .topbar-search input, .topbar-search .kbd { display: none; }
  .topbar-search { width: 40px; justify-content: center; padding: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar-bell, .topbar-div { display: none; }
  .role-btn span:not(:first-child) { display: none; }
  .content { padding: 18px 14px; }
}

/* generic row cluster */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; min-width: 160px; }
.list-card { overflow: hidden; }
.list-card .tbl thead th:first-child, .list-card .tbl tbody td:first-child { padding-left: 22px; }
.list-card .tbl thead th:last-child, .list-card .tbl tbody td:last-child { padding-right: 22px; }

.section-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: -.01em; display: flex; align-items: center; gap: 9px; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }

/* cell helpers */
.cell-main { display: flex; align-items: center; gap: 11px; }
.cell-name { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--text-faint); }
.row-actions { display: flex; gap: 6px; opacity: 0; transition: opacity .12s; justify-content: flex-end; }
tr:hover .row-actions { opacity: 1; }
@media (hover: none) { .row-actions { opacity: 1; } }

.stat-line { display: flex; align-items: baseline; gap: 8px; }
.flag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; }
.flag-vip { background: linear-gradient(135deg, #f3d27a, #d9a93a); color: #5a3d00; }
.flag-sensitive { background: var(--red-soft); color: var(--red); }

.emp-card { transition: transform .16s var(--ease), box-shadow .16s var(--ease), border-color .16s; }
.emp-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
