/* ============================================
   TraumGmbH — Layout
   App Shell, Header, Nav, Sidebar, Desktop
   ============================================ */

/* === APP SHELL === */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.app-body { flex: 1; padding-bottom: 68px; }

/* === HEADER === */
.hdr {
  padding: 22px 24px 16px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
}
.hdr-row { display: flex; justify-content: space-between; align-items: center; }
.hdr-greet { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.hdr-name { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; margin-top: 1px; }

/* === PAGE HEADER (with back button) === */
.page-hdr {
  padding: 16px 24px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.page-hdr-title { font-weight: 700; font-size: 16px; flex: 1; }

/* === SECTION TITLE === */
.stitle {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-muted); padding: 22px 24px 10px; font-weight: 700;
}

/* === BOTTOM NAV (mobile) === */
.nav-bottom {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-around;
  padding: 8px 0 max(14px, env(safe-area-inset-bottom));
  background: var(--bg-white);
  border-top: 1px solid var(--border);
  z-index: 50;
}
.nav-i {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; font-size: 10px; color: var(--text-muted);
  cursor: pointer; font-weight: 600; padding: 4px 8px;
  text-decoration: none; transition: color 0.1s;
}
.nav-i.on { color: var(--accent); }
.nav-i:hover { color: var(--text-sec); }

/* === FAB === */
.fab {
  position: fixed; bottom: 82px; right: 22px;
  width: 54px; height: 54px; background: var(--accent);
  border-radius: 16px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(192,57,43,0.25);
  cursor: pointer; border: none; color: white; z-index: 40;
  transition: transform 0.12s;
}
.fab:hover { transform: scale(1.06); }

/* === BOTTOM BAR (for actions) === */
.bottom-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  padding: 16px 24px max(16px, env(safe-area-inset-bottom));
  background: var(--bg-white); border-top: 1px solid var(--border);
  z-index: 50;
}

/* ============================================
   DESKTOP LAYOUT (>=768px)
   Sidebar, Master-Detail, Desktop overrides
   ============================================ */
@media (min-width: 768px) {
  .app-desktop { display: flex; min-height: 100vh; }

  /* === SIDEBAR === */
  .sidebar {
    width: 240px; background: var(--bg-white);
    border-right: 1px solid var(--border);
    padding: 24px 0; flex-shrink: 0;
    position: fixed; top: 0; bottom: 0; left: 0;
    display: flex; flex-direction: column;
  }
  .sidebar-logo {
    padding: 0 24px 24px;
    font-size: 18px; font-weight: 800;
    display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-logo .logo-mark {
    width: 36px; height: 36px; border-radius: 10px;
    margin-bottom: 0; font-size: 14px;
  }
  .sidebar-nav { flex: 1; padding: 16px 0; }
  .sidebar-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 24px; font-size: 14px; font-weight: 500;
    color: var(--text-sec); cursor: pointer;
    text-decoration: none; transition: all 0.1s;
    border-left: 3px solid transparent;
  }
  .sidebar-item:hover { background: var(--bg); color: var(--text); }
  .sidebar-item.on {
    color: var(--accent); background: var(--accent-pale);
    border-left-color: var(--accent); font-weight: 700;
  }
  .sidebar-user {
    padding: 16px 24px; border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
  }
  .sidebar-user-name { font-size: 13px; font-weight: 700; }
  .sidebar-user-role { font-size: 11px; color: var(--text-sec); }

  /* === SIDEBAR GROUPS (collapsible sub-navigation) === */
  .sidebar-group { margin: 2px 0; }
  .sidebar-group-title {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 24px; font-size: 14px; font-weight: 500;
    color: var(--text-sec); cursor: pointer;
    transition: color 0.1s; user-select: none;
  }
  .sidebar-group-title:hover { color: var(--text); }
  .sidebar-group-arrow {
    margin-left: auto; color: var(--text-muted);
    transition: transform 0.2s;
  }
  .sidebar-group.on .sidebar-group-arrow { transform: rotate(180deg); }
  .sidebar-group-children {
    max-height: 0; overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .sidebar-group.on .sidebar-group-children { max-height: 250px; }
  .sidebar-sub-item {
    display: block; padding: 8px 24px 8px 56px;
    font-size: 13px; font-weight: 500;
    color: var(--text-muted); text-decoration: none;
    transition: all 0.1s; border-left: 3px solid transparent;
  }
  .sidebar-sub-item:hover { color: var(--text); background: var(--bg); }
  .sidebar-sub-item.on {
    color: var(--accent); font-weight: 700;
    background: var(--accent-pale); border-left-color: var(--accent);
  }

  /* === DESKTOP MAIN === */
  .desktop-main {
    flex: 1; margin-left: 240px; padding: 32px; max-width: 1200px;
  }
  .desktop-main .page-title {
    font-size: 24px; font-weight: 800; letter-spacing: -0.3px; margin-bottom: 24px;
  }

  /* Desktop overrides (remove side margins) */
  .desktop-main .card { margin-left: 0; margin-right: 0; }
  .desktop-main .sg { margin-left: 0; margin-right: 0; }
  .desktop-main .oli { margin-left: 0; margin-right: 0; }
  .desktop-main .stitle { padding-left: 0; padding-right: 0; }
  .desktop-main .stats { padding-left: 0; padding-right: 0; }
  .desktop-main .adm-grid { padding-left: 0; padding-right: 0; }
  .desktop-main .res-row { padding-left: 0; padding-right: 0; }
  .desktop-main .act-item { margin-left: 0; margin-right: 0; }
  .desktop-main .act-filters { padding-left: 0; }
  .desktop-main .act-filters .filters { padding-left: 0; }
  .desktop-main .kanban { padding-left: 0; padding-right: 0; }

  /* Desktop grid layouts */
  .desktop-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .desktop-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
  .desktop-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

  /* Hide mobile nav on desktop */
  .app-desktop .nav-bottom { display: none; }
  .app-desktop .fab { display: none; }
  .app-desktop .app-body { padding-bottom: 0; }
}

/* === PRINT === */
@media print {
  .nav-bottom, .fab, .sidebar { display: none !important; }
  .desktop-main { margin-left: 0 !important; }
}